<?php
$glass= "water";
$bottol;`enter code here`
if(isset($glass)){
echo $glass;
}elseif(isset($bottol)){
echo "Empty Bottol";
}
echo PHP_EOL;
Ternary Operator is bellow
$demo = isset($glass) ? $glass : $bottol;
echo $demo;
But how can I echo the $glass variable as like as if/else statements inside the ternary operator?? Is it possible? Also, how can I return the $glass variable inside the ternary operator? Like: return $glass
?>
Aucun commentaire:
Enregistrer un commentaire