3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = "Features\\Contexts\\AdminContext"; $actor = explode('\\', $noContext); $actor = end(substr($actor, 0, -7)); var_dump($actor);
based on ivG1X
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: noContext in /in/CPop4 on line 4 Warning: substr() expects parameter 1 to be string, array given in /in/CPop4 on line 5 Notice: Only variables should be passed by reference in /in/CPop4 on line 5 Warning: end() expects parameter 1 to be array, null given in /in/CPop4 on line 5 NULL
Output for 5.3.0 - 5.6.28
Notice: Undefined variable: noContext in /in/CPop4 on line 4 Warning: substr() expects parameter 1 to be string, array given in /in/CPop4 on line 5 Strict Standards: Only variables should be passed by reference in /in/CPop4 on line 5 Warning: end() expects parameter 1 to be array, null given in /in/CPop4 on line 5 NULL
Output for 5.1.0 - 5.2.17
Notice: Undefined variable: noContext in /in/CPop4 on line 4 Notice: Array to string conversion in /in/CPop4 on line 5 Strict Standards: Only variables should be passed by reference in /in/CPop4 on line 5 Warning: end(): Passed variable is not an array or object in /in/CPop4 on line 5 bool(false)
Output for 5.0.5
Notice: Undefined variable: noContext in /in/CPop4 on line 4 Notice: Array to string conversion in /in/CPop4 on line 5 Fatal error: Only variables can be passed by reference in /in/CPop4 on line 5
Process exited with code 255.
Output for 5.0.4
Notice: Undefined variable: noContext in /in/CPop4 on line 4 Notice: Array to string conversion in /in/CPop4 on line 5 Warning: end(): Passed variable is not an array or object in /in/CPop4 on line 5 bool(false)
Output for 4.3.2 - 5.0.3
Notice: Undefined variable: noContext in /in/CPop4 on line 4 Notice: Array to string conversion in /in/CPop4 on line 5 Warning: end(): Passed variable is not an array or object in /in/CPop4 on line 5 bool(false)
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: noContext in /in/CPop4 on line 4 Notice: Array to string conversion in /in/CPop4 on line 5 Warning: end() [http://www.php.net/function.end]: Passed variable is not an array or object in /in/CPop4 on line 5 bool(false)