Posted by ImOk on 10/31/14 11:55
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]
|