3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $methods = array( 'POST', 'GET', 'POST', 'OPTIONS', 'TRACE', 'HEAD', 'OPTIONS', 'OPTIONS', 'OPTIONS', 'PATCH', 'DELETE', ); $matched_methods = array(); foreach ($methods as $method) { if (strcasecmp($method, 'POST') === 0 || strcasecmp($method, 'GET') === 0 || strcasecmp($method, 'OPTIONS') === 0) { $matched_methods[] = $method; } } var_dump($matched_methods);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(7) { [0]=> string(4) "POST" [1]=> string(3) "GET" [2]=> string(4) "POST" [3]=> string(7) "OPTIONS" [4]=> string(7) "OPTIONS" [5]=> string(7) "OPTIONS" [6]=> string(7) "OPTIONS" }