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);

preferences:
48.29 ms | 402 KiB | 5 Q