lucerias Posted November 10, 2006 Share Posted November 10, 2006 func->x May i know that whether the -> is used to call the x, which is a function or parameter or object belong a func, which is a class or function? Please correct if i am wrong. Thank you. Link to comment https://forums.phpfreaks.com/topic/26783-php-syntax-problem/ Share on other sites More sharing options...
doni49 Posted November 10, 2006 Share Posted November 10, 2006 It's used to access an object's methods and properties (aka functions and variables). An object is created when you instantiate a variable with a class. For example:[code]class myClass{ var name; var phone; function showPhone() //"this" is a special variable which allows methods (functions) in this class to access variables that are part of this object. echo $this->phone; }}$test as new myClass;$test->name = "Don";$test->phone = "215-333-9999";$test->showPhone(); // <--this will echo to the browser "215-333-9999"[/code] Link to comment https://forums.phpfreaks.com/topic/26783-php-syntax-problem/#findComment-122491 Share on other sites More sharing options...
doni49 Posted November 10, 2006 Share Posted November 10, 2006 http://us3.php.net/classhttp://us3.php.net/object Link to comment https://forums.phpfreaks.com/topic/26783-php-syntax-problem/#findComment-122493 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.