question 1.what is the difference between function and method in a php code...
question 2.
what is the difference between between two following declaration
$abc;
var $abc;
method and function
Moderator: General Moderators
Re: method and function
A function (or "subroutine") is a generic term. A method is a function that belongs to a class.
sprintf and mysqli_query are functions, DateTime::add and mysqli::query are methods.
$abc; is not a declaration. PHP does not have those for regular global variables.
var $abc; declares a member variable of a class. It is a PHP 4 feature (see this) and was replaced with public in PHP 5.
sprintf and mysqli_query are functions, DateTime::add and mysqli::query are methods.
$abc; is not a declaration. PHP does not have those for regular global variables.
var $abc; declares a member variable of a class. It is a PHP 4 feature (see this) and was replaced with public in PHP 5.