3v4l.org

run code in 300+ PHP versions simultaneously
<?php class BaseStream { public function mkdir($dir, $mode = -1, $recursive = false) { die('base mkdir called!'); } } class VariableStream extends BaseStream { function _stream_metadata($path, $option, $var) { if($option == STREAM_META_TOUCH) { $url = parse_url($path); $varname = $url["host"]; if(!isset($GLOBALS[$varname])) { $GLOBALS[$varname] = ''; } return true; } return false; } private function _mkdir($dir, $mode, $options) { echo "mkdir worked!\n"; } public function __call($name, $arguments) { echo "call $name\n"; $name = '_' . $name; if (!method_exists($this, $name)) { return false; } return $this->$name(...$arguments); } } stream_wrapper_register("var", "VariableStream") or die("Failed to register protocol"); mkdir("var://mytest");
Output for 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
Deprecated: Creation of dynamic property VariableStream::$context is deprecated in /in/PFpvi on line 46 base mkdir called!
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Deprecated: Creation of dynamic property VariableStream::$context is deprecated in /in/PFpvi on line 46 base mkdir called!
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
base mkdir called!

preferences:
101.96 ms | 402 KiB | 154 Q