Hacker News new | past | comments | ask | show | jobs | submit login

Actually, here's a more insane version:

  $x = 0;

  if(!empty($x)){

    echo '"0" is empty';

  }



empty() is an alias for 'isset($x) && $x', so this example is semantically identical to the previous one (since $x is always set). PHP doesn't have any special concept of "emptyness" to check for.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: