PHP echo no text if $name is not filled in or == 0 else echo $name
For example here's what I have:
<?php
if ($name == 0)
{ 
echo $name;
}
else
{
echo "Nothing here.";
?>
PHP echo no text if $name is not filled in or == 0 else echo $name
For example here's what I have:
<?php
if ($name == 0)
{ 
echo $name;
}
else
{
echo "Nothing here.";
?>
 
    
    <?php
if (empty($name))
{ 
  echo "Nothing here.";
}
else
{
  echo $name; 
}
?>
empty() -> Gives True if ist emty!
 
    
    check if this is working:
<?php
if ($name == 0)
    {echo "Nothing here";}
else
    {echo $name;}
?>
 
    
     
    
    See this php is null or empty?
The code should be
<?php
if ($name === NULL) {
    echo "Nothing here.";
} else {
    echo $name;
}
?>
Why not try
<?php
echo empty($name)? 'Nothing here.' : $name;
?>
empty() return true means $name is null, 0 or not defined.
