3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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.2.0
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.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.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.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.