3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['轻型飞', '机无人', '机广告飞', '艇无人飞', '艇遥控飞', '艇航拍飞', '艇载人气', '球三角', '翼动力三角', '翼滑翔', '机测绘无人', '机大疆无人', '机遥控无人', '机航拍飞行', '器航拍无人', '机飞', '艇滑翔', '伞遥控飞', '机动力滑翔', '伞载人飞', '艇动力', '伞运动飞', '机三角翼飞', '机飞行航', '模四轴飞', '行遥控四', '轴燃油遥控飞', '机燃油遥控直升', '机油动遥控飞', '机油动遥控直升', '机四旋翼飞行', '器四旋翼无人', '机遥控航', '模无人驾驶自由气', '球系留气', '球四轴飞行', '器超轻型飞', '机轻型直升机', '超轻型直升机', '四轴无人机', '四轴航模']; $sqls = []; $head = 'select id,goods_name,content,goods_description from shop_goods where '; foreach ($arr as $v) { $fields = ['goods_name' => "'%$v%'", 'content' => "'%$v%'", 'goods_description' => "'%$v%'"]; $sql = (http_build_str($fields)); $sql = str_replace('=', ' like ', $sql); $wheres = explode('&', $sql); foreach ($wheres as $where) { $sqls[] = $head.$where; } } foreach ($sqls as $sql) { echo $sql."\n"; }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 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 http_build_str() in /in/hfvFc:10 Stack trace: #0 {main} thrown in /in/hfvFc on line 10
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
Fatal error: Call to undefined function http_build_str() in /in/hfvFc on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/hfvFc on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/hfvFc on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/hfvFc on line 2
Process exited with code 255.

preferences:
241.62 ms | 401 KiB | 356 Q