3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class thisClass { public $files = array('a č o.png','a č o.png','a č o.png'); } $foo = new thisClass(); define('URL', '127.0.0.1/'); foreach($foo->$files as $key => $value){ echo '<a href="' . URL . 'file/show/' . rawurlencode($foo->$files[$key]) . '" target="_blank"> Show file </a>' . "\n"; //gives link leading to: 127.0.0.1/file%2Fshow%2Fa č o.png $address = rawurlencode($filename); echo '<a href="' . URL . 'file/show/' . $foo->$files[$key] . '" target="_blank"> Show file </a>'; //gives link leading to: 127.0.0.1/file/show/a č o.png } ?>
based on taWFI
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: files in /in/XhYb2 on line 7 Notice: Undefined property: thisClass::$ in /in/XhYb2 on line 7 Warning: Invalid argument supplied for foreach() in /in/XhYb2 on line 7
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: files in /in/XhYb2 on line 7 Fatal error: Uncaught Error: Cannot access empty property in /in/XhYb2:7 Stack trace: #0 {main} thrown in /in/XhYb2 on line 7
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Notice: Undefined variable: files in /in/XhYb2 on line 7 Fatal error: Cannot access empty property in /in/XhYb2 on line 7
Process exited with code 255.