3v4l.org

run code in 300+ PHP versions simultaneously
<?php function depbuild($name, $location, $suffix, $locale) { $locales = $locale ? array($locale, null) : array(null); $extensions = array_filter(array( ($location && $suffix) ? implode('-', array($location, $suffix)) : null, $suffix ?: null, $location ?: null, )); $extensions[] = null; $routing = array(); foreach ($locales as $lang) { foreach ($extensions as $extension) { echo implode('-', array_filter(array( $name, $extension, $lang, ))) . '.html'.PHP_EOL; } } } $name = 'foo'; $location = array(null, 'GL', 'AS'); $suffix = array(null, 'P','C'); $locale = array(null, 'fr_FR'); foreach($location as $loc) { foreach($suffix as $s) { foreach($locale as $l) { depbuild($name, $loc, $s, $l); echo PHP_EOL.'--------'.PHP_EOL; } } }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
foo.html -------- foo-fr_FR.html foo.html -------- foo-P.html foo.html -------- foo-P-fr_FR.html foo-fr_FR.html foo-P.html foo.html -------- foo-C.html foo.html -------- foo-C-fr_FR.html foo-fr_FR.html foo-C.html foo.html -------- foo-GL.html foo.html -------- foo-GL-fr_FR.html foo-fr_FR.html foo-GL.html foo.html -------- foo-GL-P.html foo-P.html foo-GL.html foo.html -------- foo-GL-P-fr_FR.html foo-P-fr_FR.html foo-GL-fr_FR.html foo-fr_FR.html foo-GL-P.html foo-P.html foo-GL.html foo.html -------- foo-GL-C.html foo-C.html foo-GL.html foo.html -------- foo-GL-C-fr_FR.html foo-C-fr_FR.html foo-GL-fr_FR.html foo-fr_FR.html foo-GL-C.html foo-C.html foo-GL.html foo.html -------- foo-AS.html foo.html -------- foo-AS-fr_FR.html foo-fr_FR.html foo-AS.html foo.html -------- foo-AS-P.html foo-P.html foo-AS.html foo.html -------- foo-AS-P-fr_FR.html foo-P-fr_FR.html foo-AS-fr_FR.html foo-fr_FR.html foo-AS-P.html foo-P.html foo-AS.html foo.html -------- foo-AS-C.html foo-C.html foo-AS.html foo.html -------- foo-AS-C-fr_FR.html foo-C-fr_FR.html foo-AS-fr_FR.html foo-fr_FR.html foo-AS-C.html foo-C.html foo-AS.html foo.html --------
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected ':' in /in/WePho on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected ':' in /in/WePho on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/WePho on line 7
Process exited with code 255.

preferences:
307.39 ms | 401 KiB | 461 Q