Page 1 of 1
PHP 4.4.5 call chaining?
Posted: Mon Mar 19, 2007 4:45 pm
by alex.barylski
Considering the PHP version, shouldn't that throw a fatal error? When was that functionality added?
Posted: Mon Mar 19, 2007 4:46 pm
by feyd
I think that's been in there a while.
Posted: Mon Mar 19, 2007 5:11 pm
by alex.barylski
Really? Huh...I could have swore it was added in PHP5...
I can't find anything on it either...I guess the changelog would be a good place to start, but frick...
I used to use firepages...when I first started with PHP and I think that was PHP3...
Hmmm...interesting cause I love that feature, but I totally thought it was part of the PHP5 new object model
Thanks man
Posted: Mon Mar 19, 2007 5:42 pm
by volka
The php.exe from
http://museum.php.net/win32/php-4.0.0-Win32.zip accepts
Code: Select all
<?php
class foo {
function bar() {
echo 'phpversion: ', phpversion(), "\n";
}
}
class xyz {
var $_obj;
function xyz() {
$this->_obj = new foo;
}
function abc() {
$this->_obj->bar();
}
}
$xyz = new xyz;
$xyz->abc();
and prints
X-Powered-By: PHP/4.0.0
Content-type: text/html
phpversion: 4.0.0
Posted: Mon Mar 19, 2007 7:26 pm
by Chris Corbyn
Are you thinking of trying to use a return value in object context perhaps?
Code: Select all
//wont work
$foo->_getObj()->someMethod();
Posted: Tue Mar 20, 2007 12:22 am
by Kieran Huggins

go Hockey! Return $this, it drives everyone here nuts

Posted: Tue Mar 20, 2007 8:06 am
by feyd
I like chaining.
