Skip to main content

Posts

Openings for different technoogies.

Recent posts

What is Member Variable and Member function?

  Member Variable   − These are the variables defined inside a class. This data will be invisible to the outside of the class and can be accessed via member functions. These variables are called attribute of the object once an object is created. Member function  − These are the function defined inside a class and are used to access object data.

What is Constructor and Destructor?

  Constructor: Constructor is a special type of function which will be called automatically whenever there is any object created from a class. //Old (PHP4) class myClass{ function myClass(){ // Define logic in constructor } } //New (PHP5+) class myClass{ function __construct(){ // Define logic in constructor } } Note- Old style constructors are DEPRECATED in PHP 7.0, and will be removed in a future version. You should always use __construct() in new code. Destructor: Destructor is a special type of function which will be called automatically whenever any object is deleted or goes out of scope. class myClass{ function __construct(){ // Define logic in constructor } function __destruct(){ // this is destructor } } Types of constructors: Default constructor A constructor without any parameters is called a default constructor. Parameterized constructor A constructor with at least one parameter is called a parametrized constructor. class Person{ pub

What is the relation between Classes and Objects?

  They look very much same but are not same. A class is a definition, while an object is an instance of the class. A class is a blueprint while objects are actual objects existing in the real world. Suppose we have a class Person which has attributes and methods like name, age, height, weight, color etc. Class Person is just a prototype, now we can create real-time objects of class Person. #Example:   Ajay  is real time object of class  Person , which have name=Ajay, age=23, height=170cm, weight=60kg and color=black etc. Class A way to bind data and associated functions together. Class have many objects. Class is a template for creating objects. It is logical existence. Memory space is not allocated, when it is created. Definition (Declaration) is created once. Class is declared using "class" keyword. Object Basic runtime entity in object oriented environment. Object belongs to only class. Object are a implementation of class. It is physical existence. Memory space is allocat

Is PHP a strongly typed language?

  No. PHP is a weakly typed or loosely typed language. This means PHP does not require to declare data types of the variable when you declare any variable like the other standard programming languages C# or Java. When you store any string value in a variable, then the data type is the string and if you store a numeric value in that same variable then the data type is an Integer. Sample code: $var = "Hello" ; //String $var = 10; //Integer