Posted by Mike Zhang on 11/27/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]
|