3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; } }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
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.

preferences:
152.28 ms | 404 KiB | 189 Q