Hi a am hesitant to ask this but I need some advise about this sample code and what is better between the two function below.
function get_product($productType){
$product =[];
if('available'== $productType){
$product = array('tshirt','pants','polo');
}else if('out_of_stock' == $productType){
$product = array('short');
}
return $product;
}
or
function get_product($productType){
$product = array('tshirt','pants','polo');
if('out_of_stock' == $productType){
$product = array('short');
}
return $product;
}
I just want to get the opinion of some programmers.Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire