Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP classes question

Name: Anonymous 2007-05-02 16:46 ID:sE0QAwWQ

/prog/, I've got a class in PHP with a member named guide-agent (translated from an XML-RPC object) but I can't access it via $className->guide-agent . Here is a snip from print_r( $className );

stdClass Object
(
[guide-agent] => maria
...

Name: Anonymous 2007-05-02 16:52 ID:RmJoh694

php -r "class A { public $you-fail; }"
Parse error: syntax error, unexpected '-', expecting ',' or ';' in Command line
code on line 1


However:

php -r "class A { function __construct(){$this->{'you-fail'}=true;} } $a=new
 A();var_dump($a); print $a->{'you-fail'};"
object(A)#1 (1) {
  ["you-fail"]=>
  bool(true)
}
1

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List