3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $commonNames = ["*.jemoeder.nl", "blaat.jemoeder.nl"]; if(count($commonNames) == 0) { return null; } usort($commonNames, function($a, $b) { $aIsWildcard = substr($a, 0, 1) == '*'; $bIsWildcard = substr($b, 0, 1) == '*'; return $aIsWildcard && $bIsWildcard ? -1 : 1; } ); var_dump( $commonNames[0]);
based on aUubk
Output for 7.0.0 - 7.2.0
string(17) "blaat.jemoeder.nl"
Output for 5.4.11 - 5.6.28
string(13) "*.jemoeder.nl"
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/h8Qpd on line 3
Process exited with code 255.