3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Turn your junk into an array $includes = array( "inc/related-portfolio-aaa.php", "inc/related-portfolio-bbb.php", "inc/related-portfolio-ccc.php", "inc/related-portfolio-bbb.php" ); // Loop that shit foreach($includes as $inc){ $include = true; // Check if the current filename is in the format you mentioned //if(strpos(__FILE__, "-project.php") !== false){ // Get the prefix of the current filename $prefix = explode("-", __FILE__)[0]; // Get the suffix of the include $suffix = explode(".", explode("-", $inc)[2])[0]; // Check if it matches //if($prefix === $suffix) $include = false; echo $prefix." - ".$suffix."\n"; } //if($include) include $inc; }
Output for 7.0.0
Parse error: syntax error, unexpected '}', expecting end of file in /in/knCXJ on line 27
Process exited with code 255.
Output for 5.4.10 - 5.6.16
Parse error: syntax error, unexpected '}' in /in/knCXJ on line 27
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/knCXJ on line 19
Process exited with code 255.