true, quant'=>".$quant.", 'cd'=>".$catalog['name'][$cd].", 'total_price'=>".$quant*$catalog['price'][$cd]."}"; else $result="In Stock - ".$quant." ".$catalog['name'][$cd]."@$".$catalog['price'][$cd]." - Total Price= $" . $quant*$catalog['price'][$cd]; } else { if($format=="json") $result="{'Transaction'=>false, 'stock'=>".$catalog['stock'][$cd]."}"; else $result="Sorry, Out of Stock."; } return array('invoice'=>$result); } // this fixes problem 3 - we can serve json // problem 4 - we need another function to create a catalog view ?>