3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace foo\bar; class bat { }; function get_declared_classes($in_namespace = null) { if ($in_namespace === null) { return \get_declared_classes(); } if ($in_namespace{0} == '\\') { $in_namespace = substr($in_namespace, 1); } if (substr($in_namespace, -1) != '\\') { $in_namespace .= '\\'; } var_dump($in_namespace); $filter = new \RegexIterator(new \ArrayIterator(\get_declared_classes()), '/^' .\preg_quote($in_namespace). '.*$/'); return \iterator_to_array($filter); } var_dump(get_declared_classes("foo\\bar"));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/E23b1 on line 13
Process exited with code 255.
Output for 7.4.33
Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/E23b1 on line 13 string(8) "foo\bar\" array(1) { [140]=> string(11) "foo\bar\bat" }
Output for 7.4.0 - 7.4.32
Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/E23b1 on line 13 string(8) "foo\bar\" array(1) { [162]=> string(11) "foo\bar\bat" }
Output for 7.3.32 - 7.3.33
string(8) "foo\bar\" array(1) { [139]=> string(11) "foo\bar\bat" }
Output for 7.3.0 - 7.3.31
string(8) "foo\bar\" array(1) { [160]=> string(11) "foo\bar\bat" }
Output for 7.2.0 - 7.2.33
string(8) "foo\bar\" array(1) { [158]=> string(11) "foo\bar\bat" }
Output for 7.1.0 - 7.1.25
string(8) "foo\bar\" array(1) { [156]=> string(11) "foo\bar\bat" }
Output for 7.0.0 - 7.0.4, 7.0.20
string(8) "foo\bar\" array(1) { [153]=> string(11) "foo\bar\bat" }
Output for 7.0.6
string(8) "foo\bar\" array(1) { [152]=> string(11) "foo\bar\bat" }
Output for 7.0.5
string(8) "foo\bar\" array(1) { [133]=> string(11) "foo\bar\bat" }
Output for 5.6.8 - 5.6.12, 5.6.16 - 5.6.19, 5.6.28
string(8) "foo\bar\" array(1) { [143]=> string(11) "foo\bar\bat" }
Output for 5.5.24 - 5.5.28, 5.5.31 - 5.5.33, 5.5.35, 5.6.21
string(8) "foo\bar\" array(1) { [142]=> string(11) "foo\bar\bat" }
Output for 5.6.13 - 5.6.15, 5.6.20
string(8) "foo\bar\" array(1) { [124]=> string(11) "foo\bar\bat" }
Output for 5.5.29 - 5.5.30, 5.5.34
string(8) "foo\bar\" array(1) { [123]=> string(11) "foo\bar\bat" }

preferences:
160.84 ms | 401 KiB | 194 Q