i'm beginning php , understand in order parse variables echo must enclosed between double quotation marks. when run script:
echo "you have: money::add($coin1, $coin2)<br>"; //"add" returns integer
i error saying can't convert class money string. know can rewritten this:
echo 'you have: ' . money::add($coin1, $coin2) . '<br>';
but when there lots of return values, variables , on involved echo, wonder if there i'm missing make code cleaner , shorter.
you need modify this
$money = new money; //create object class money $result=$money->add($coin1, $coin2) //call function echo 'you have: ' .$result . '<br>';
Comments
Post a Comment