3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Copied from tests/_support/Commands/Foobar.php $template = "<?php use Config\App; use CodeIgniter\CLI\CLI; return [ 'foo' => 'The command will use this as foo.', 'bar' => 'The command will use this as bar.', 'baz' => 'The baz is here.', 'bas' => CLI::color('bas', 'green') . (new App())->baseURL, ]; "; preg_match( '/(?P<imports>(?:^use [^;]+;$\n?)+)/m', $template, $match ); var_dump($match); // empty 'imports'
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
array(3) { [0]=> string(41) "use Config\App; use CodeIgniter\CLI\CLI; " ["imports"]=> string(41) "use Config\App; use CodeIgniter\CLI\CLI; " [1]=> string(41) "use Config\App; use CodeIgniter\CLI\CLI; " }

preferences:
44.42 ms | 406 KiB | 5 Q