3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $commonNames = ["*.jemoeder.nl", "lekker.jemoeder.nl"]; if(count($commonNames) == 0) { return null; } usort($commonNames, function($a, $b) { $aIsWildcard = strpos($a, "*") === 0; $bIsWildcard = strpos($b, "*") === 0; return $aIsWildcard && $bIsWildcard ? -1 : 1; } ); var_dump($commonNames[0]);
based on Ziqkv
Output for 7.0.0 - 7.2.0
string(18) "lekker.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/9luBv on line 3
Process exited with code 255.