3v4l.org

run code in 500+ 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.34, 8.2.1 - 8.2.32, 8.3.0 - 8.3.33, 8.4.1 - 8.4.24, 8.5.0 - 8.5.9
param1=1 param1=1&param2=test

preferences:
105.84 ms | 896 KiB | 4 Q