1. <?php
  2. error_reporting(E_ALL);
  3. $a = 'simon';
  4. echo $a;
  5. echo $a[99]; // PHP notice
  6. echo $a['x']; // returns 's' on 5.2, Warning on 5.4
  7. echo $a[99][99]; // FATAL ERROR on 5.2, Notice on 5.4
  8. echo $a[99]['x']; // FATAL ERROR on 5.2, Warning on 5.4
  9. echo $a['x']['x']; // FATAL ERROR on 5.2, Warning on 5.4
  10. $a = '';
  11. echo $a; // empty
  12. echo $a[99]; // PHP notice
  13. echo $a['x']; // PHP Warning
  14. echo $a[99][99]; // FATAL ERROR on 5.2, Notice on 5.4
  15. echo $a[99]['x']; // FATAL ERROR on 5.2, Warning on 5.4
  16. echo $a['x']['x']; // FATAL ERROR on 5.2, Warning on 5.4
  17. $a = array();
  18. echo $a; // returns 'Array'
  19. echo $a[99]; // PHP notice
  20. echo $a['x']; // PHP notice
  21. echo $a[99][99]; // PHP notice
  22. echo $a[99]['x']; // PHP notice
  23. echo $a['x']['x']; // PHP notice
  24. $a = null;
  25. echo $a; // empty string
  26. echo $a[99]; // empty string
  27. echo $a['x']; // empty string
  28. echo $a[99][99]; // empty string
  29. echo $a[99]['x']; // empty string
  30. echo $a['x']['x']; // empty string

Fatal errors example

Comments powered by Disqus