grabmail
03-10-2006, 12:42 PM
Is this a new language construct in php?
Is it the same as $object->array('var')?
If yes,
that means, can i substitute this
$object->array('var', 'test', 'one')
WITH
$object->{'var', 'test', 'one'}
If yes, it's so cool.
laserlight
03-10-2006, 12:59 PM
I dont think so. $object->{'var'} should be the same as $object->var
arkin
03-10-2006, 02:16 PM
Test it out.
I find that the best way of finding stuff out.
print_r($val) gives a good peice of information about an array if it is.
grabmail
03-10-2006, 03:47 PM
You're right. It's a var.
Funny. Then why some website use that syntax...
ZiDev
03-10-2006, 09:43 PM
$foo = 'bar';
$Tar->{$foo . '_string'}()
would execute the function "bar_string" in class $Tar. I think the construct was added in php 4.
-- HW
portlandwebdev
03-19-2006, 11:42 PM
yes ZiDev, as used with the dir() function. The single arrow executes a command for that function.
$dir = dir("./");
$cont = $dir->read();