I can't get the return value! The Output appears 'ERROR'.
$c = new List();
$result = $c->create();
if( $result == "a"){
echo("A");
}else if($result == "b"){
echo("B");
}else{
echo("ERROR");
}
class List{
function create(){
// $rVal = ...
if($rVal == 1){
return "a";
}else if($rVal == 2){
return "b";
}
}
}
when I change return to echo, the output appears 'aERROR'. I don't understand. create function works but the return value is not true. Can anyone help me please? Sorry for my bad English