3v4l.org

run code in 300+ PHP versions simultaneously
<?php $params = [ 'param1' => 1, 'param2' => new Class { public function __toString():string {return 'test';} } ]; echo http_build_query($params) . PHP_EOL; foreach ($params as $k => &$v) $params[$k] = (string) $v; echo http_build_query($params) . PHP_EOL;
Output for 8.1.23 - 8.1.28, 8.2.1 - 8.2.19, 8.3.0 - 8.3.7
param1=1 param1=1&param2=test

preferences:
73.32 ms | 402 KiB | 30 Q