3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Creation of dynamic property testStreamWrapper::$context is deprecated in /in/h1SVU on line 15 int(1) int(2) int(3) int(5) int(6)
Output for 5.2.7 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
int(1) int(2) int(3) int(5) int(6)
Output for 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 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

preferences:
207.11 ms | 401 KiB | 325 Q