3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $links = array( "product.php?shopprodid=1057&variantid=2942" => "https://storksak.com/changing-bags", "index.php?pageid=2" => "https://storksak.com/changing-bags/olivia", "changing-bags/shoulder-bag/emma.html" => "https://storksak.com/changing-bags/emma" ); foreach ($links as $url => $tourl){ $parsed_url = parse_url($url); $query = isset($parsed_url['query']) ? $parsed_url['query'] : ''; parse_str($query,$parts); if (isarray($parts)){ if (isset($parts["shopprodid"]) && isset($parts["variantid"])){ echo 'RewriteCond %{QUERY_STRING} ^shopprodid='.$parts["shopprodid"].'&variantid='.$parts["variantid"].'$'."\n"; echo 'RewriteRule ^product.php$ '.$tourl.' [R=301,L]'."\n"; } elseif (isset($parts["pageid"])){ echo 'RewriteCond %{QUERY_STRING} ^pageid='.$parts["pageid"].'$'."\n"; echo 'RewriteRule ^index.php$ '.$tourl.' [R=301,L]'."\n"; } elseif (isset($parts["shopcatid"])){ echo 'RewriteCond %{QUERY_STRING} ^shopcatid='.$parts["shopcatid"].'$'."\n"; echo 'RewriteRule ^shop.php$ '.$tourl.' [R=301,L]'."\n"; } } else { echo 'RewriteRule ^'.$url.'$ '.$tourl.' [R=301,L]'."\n"; } }
based on i8UDr
Output for 7.0.0 - 7.3.0rc3
Fatal error: Uncaught Error: Call to undefined function isarray() in /in/tSisU:16 Stack trace: #0 {main} thrown in /in/tSisU on line 16
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Call to undefined function isarray() in /in/tSisU:16 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined function isarray() in /in/tSisU on line 16
Process exited with code 255.