3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class testStreamWrapper { function stream_lock($operation) { var_dump($operation); return true; } function stream_open($path, $mode, $options, $opened_path) { return true; } } stream_wrapper_register('test', 'TestStreamWrapper'); $fp = fopen('test://waa', 'w+'); flock($fp, LOCK_SH); flock($fp, LOCK_EX); flock($fp, LOCK_UN); flock($fp, LOCK_SH | LOCK_NB); flock($fp, LOCK_EX | LOCK_NB);
based on NnOjY
Output for 5.2.7 - 7.2.0
int(1) int(2) int(3) int(5) int(6)
Output for 5.0.5 - 5.2.6
int(1) int(2) int(8) int(5) int(6)
Output for 5.0.0 - 5.0.4
int(1) int(2) int(8) int(5) int(6)
Process exited with code 139.
Output for 4.3.2 - 4.3.8, 4.4.0 - 4.4.9
Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 16 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 17 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 18 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 19 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 20
Output for 4.3.9 - 4.3.11
Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 16 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 17 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 18 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 19 Warning: flock(): cannot represent a stream of type user-space as a File Descriptor in /in/h1SVU on line 20
Process exited with code 139.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: stream_wrapper_register() in /in/h1SVU on line 13