Reply to array bugs?

Your name:

Reply:


Posted by 7h@ch on 08/06/06 08:56

Sorry if I sounds like a noob (because I am one, here). I ran across
this earlier, and it kept bugging me. I guess someone here know a good
answer.

To summerize, I was using array within a class. After some
manipulation, the value of the array's element that I needed wasn't
"echoed" right.

For instance,

class FootballClub
{
public $name;
public $stadium = "junkyard";
public $roster = array("gk"=>"clown", "st"=>"fool");
public $coach;
}

$myclub = new FootballClub();
$myclub->name = "Liverpool";

if ($myclub->name == "Liverpool")
{
$myclub->stadium = "Anfield";
$myclub->coach = "Rafa Benitez";
$myclub->roster["gk"] = "Pepe Reina";
$myclub->roster["st"] = "Robbie Fowler";
}


$myplayer = $myclub->roster[gk];
echo "your team plays at: $myclub->stadium<br>";
echo "your goal keeper is: $myclub->roster[gk]<br>");

---------
Problem:

As is, the 2nd line output is: "your goal keeper is: Array[gk]" thought
$myplayer gets the right value.

Any plausible explaination, please?

Thanks.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация