-1

even after commenting out the echo function its still displaying null on a null value.i jx want ti use it a function not to output.

<?php 
     if (var_dump($row['display_photo']) === null) {
            //echo "null";
            }else {
            echo "not null";
            }
?>
7
  • you can use empty: if(empty($row['display_photo'])) php.net/manual/en/function.empty.php Commented Jun 21, 2018 at 2:04
  • Did you try to remove var_dump function from your condition? Commented Jun 21, 2018 at 2:05
  • isset($row['display_photo']) is sufficient "Determine if a variable is set and is not NULL". also, where in the world did you get the idea that var_dump() would be a good idea inside of a conditional statement like that? Commented Jun 21, 2018 at 2:06
  • thanx for the responses....i have settled with is_null(). Commented Jun 21, 2018 at 2:10
  • Will the index $row['display_photo'] always exist? Commented Jun 21, 2018 at 2:13

1 Answer 1

0

Use isset or empty functions.

<?php 
     if (empty($row['display_photo'])) {
            //echo "null";
            }else {
            echo "not null";
            }
?>
Sign up to request clarification or add additional context in comments.

1 Comment

0 is empty and not null

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.