3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ab implements Serializable{ protected $x; function __construct() { $this->x = 'val'; } public function serialize() { throw new Exception('Can\'t serialize '); } public function unserialize($str) { throw new Exception('Can\'t serialize '); } } try{ $tmp = serialize(new Ab()); }catch($e Exception){ var_dump($e); }
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '$e' (T_VARIABLE), expecting identifier (T_STRING) or namespace (T_NAMESPACE) or \\ (T_NS_SEPARATOR) in /in/eu2Jt on line 27
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR in /in/eu2Jt on line 27
Process exited with code 255.

preferences:
191.07 ms | 1395 KiB | 67 Q