You are here: Re: get object value « PHP Programming Language « IT news, forums, messages
Re: get object value

Posted by Mike Zhang on 12/17/85 11:55

Thanks,
It seems working now.

mz

"ImOk" <jon.macaroni@gmail.com> wrote in message
news:1155526113.891004.203830@m79g2000cwm.googlegroups.com...
> Did you even run this code? Your code is full of syntax and runtime
> errors. Here is the fixed up version.
>
> <?php
> Class Shop{
> var $mID;
> var $mName;
>
> function setID( $id ){
> $this->mID=$id;
> }
>
> function getID(){
> return $this->mID;
> }
>
> function setName( $name ){
> $this->mName=$name;
> }
>
> function getName(){
> return $this->mName;
>
> }
> }
>
> function makelist( ){
> $vector=array();
> $aShop = new Shop();
> for( $i=0;$i<10;$i++){
> $aShop->setID($i);
> $aShop->setName("shopname".$i);
> $vector[]=$aShop;
> }
> return $vector;
> }
>
> $shoplist = makelist();
>
> for( $j=0;$j<10;$j++){
> echo "ID: " . $shoplist[$j]->getID()."Name:
> ".$shoplist[$j]->getName();
> }
>
> ?>
>

 

Navigation:

[Reply to this 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

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