3v4l.org

run code in 300+ PHP versions simultaneously
<?php //////////////////////////// /** * IRCBot = root directory. * * @file: IRCBot/src/Connect.php */ namespace Connect; class Connect { protected $server; // Planning to use this for the YAML config protected $port; // Planning to use this for the YAML config public function connect($server, $port) { try { fsockopen($server, $port); } catch (Exception $e) { echo "[ERROR] " . $e; } return $this; // I want to chain this function with a function called sendUserData... } } //////////////////////////// /** * IRCBot = root directory. * * @file: IRCBot/src/Start.php */ namespace Connect; class Start { // I want to run all functions on startup public function __construct(Connect $connect) { $connect->connect("irc.freenode.net", 6667); } } //////////////////////////// /** * IRCBot = root directory. * * @file: IRCBot/index.php */ require_once 'src/Start.php'; require_once 'src/Connect.php'; use Connect\Connect; use Connect\Start; error_reporting(E_ALL); // @TODO: [ ] Add a utility that get's the native timezone; date_default_timezone_set("UTC"); $connect = new Connect(); var_dump($connect); $start = new Start($connect); var_dump($start);
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: require_once(): open_basedir restriction in effect. File(src/Start.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3IBBN on line 48 Warning: require_once(src/Start.php): Failed to open stream: Operation not permitted in /in/3IBBN on line 48 Fatal error: Uncaught Error: Failed opening required 'src/Start.php' (include_path='.:') in /in/3IBBN:48 Stack trace: #0 {main} thrown in /in/3IBBN on line 48
Process exited with code 255.
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 Warning: require_once(): open_basedir restriction in effect. File(src/Start.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3IBBN on line 48 Warning: require_once(src/Start.php): Failed to open stream: Operation not permitted in /in/3IBBN on line 48 Fatal error: Uncaught Error: Failed opening required 'src/Start.php' (include_path='.:') in /in/3IBBN:48 Stack trace: #0 {main} thrown in /in/3IBBN on line 48
Process exited with code 255.
Output for 8.0.13
Warning: require_once(src/Start.php): Failed to open stream: No such file or directory in /in/3IBBN on line 48 Fatal error: Uncaught Error: Failed opening required 'src/Start.php' (include_path='.:') in /in/3IBBN:48 Stack trace: #0 {main} thrown in /in/3IBBN on line 48
Process exited with code 255.
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.3.32 - 7.3.33, 7.4.33
Warning: require_once(src/Start.php): failed to open stream: No such file or directory in /in/3IBBN on line 48 Fatal error: require_once(): Failed opening required 'src/Start.php' (include_path='.:') in /in/3IBBN on line 48
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32
Warning: require_once(): open_basedir restriction in effect. File(src/Start.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3IBBN on line 48 Warning: require_once(src/Start.php): failed to open stream: Operation not permitted in /in/3IBBN on line 48 Fatal error: require_once(): Failed opening required 'src/Start.php' (include_path='.:') in /in/3IBBN on line 48
Process exited with code 255.

preferences:
173.97 ms | 402 KiB | 224 Q