fork(1) download
  1. <?php
  2.  
  3. function Prod($prod) {
  4. if (strlen($prod['img']) > 0) {
  5. echo 'Image with $prod["img"] = '.$prod['img']."\n";
  6. } else {
  7. echo 'Image without $prod["img"]'."\n";
  8. }
  9. echo "\n";
  10. }
  11.  
  12. Prod(array('img' => 'test'));
  13. Prod(array('img' => ''));
  14. Prod('test');
  15.  
Success #stdin #stdout #stderr 0.02s 52472KB
stdin
Standard input is empty
stdout
Image with $prod["img"] = test

Image without $prod["img"]

Image with $prod["img"] = t

stderr
PHP Warning:  Illegal string offset 'img' in /home/fyajjb/prog.php on line 4
PHP Warning:  Illegal string offset 'img' in /home/fyajjb/prog.php on line 5