3v4l.org

run code in 300+ PHP versions simultaneously
<?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.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected '}' in /in/knCXJ on line 27
Process exited with code 255.

preferences:
165.98 ms | 1395 KiB | 24 Q