Fixed - Re: [PHP] PHP4 Broke this - Suggestions?

From: Date: Fri, 20 Oct 2000 16:27:44 +0000
Subject: Fixed - Re: [PHP] PHP4 Broke this - Suggestions?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-21423@lists.php.net to get a copy of this message
Fixed - PHP4 seems to be more strict on format than PHP3 - array(anchor => "blah"); won't work, but array("anchor" => "blah"); does work. Drove me crazy trying to find that. All in the quotes... Thanks to all that replied, Mike Michael Vanecek wrote: > > This worked fine in PHP3, and stopped working in PHP4. Actually, this is > a diagnostic copy of a different class with the names changed to protect > the innocent . :) But the code below worked in PHP3. Sorry for the silly > names - I had to blow some steam... > > class BooBoo { > var $common = array( > anchor => "<A%s>%s</A>", > ahref => " href=\"%s\"", > acontent => "%s" > ); > function Diddle($ar) { > $anchor = $ar["anchor"]; > $ahref = $ar["ahref"]; > $acontent = $ar["acontent"]; > if(isset($ahref) && $ahref){$anattrib = > sprintf($this->common["ahref"],$ahref);} > if(isset($acontent) && $acontent){$str = > sprintf($this->common["acontent"],$acontent);} > if($anchor){$link = > sprintf($this->common["anchor"],$anattrib,$str); > return($link); > } > } > } > $jeepers = new BooBoo; > $wipme = $jeepers->Diddle($ar=array( > anchor => anchor, > ahref => $an, > acontent => $bn)); > echo "$wipme <BR>";

« previous php.general (#21423) next »