3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("T1","one"); define("T2","two"); $test='number %2$s'; $test=sprintf($test, T1); echo $test;
Output for 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 ArgumentCountError: 3 arguments are required, 2 given in /in/8jkZm:7 Stack trace: #0 /in/8jkZm(7): sprintf('number %2$s', 'one') #1 {main} thrown in /in/8jkZm on line 7
Process exited with code 255.
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
Warning: sprintf(): Too few arguments in /in/8jkZm on line 7

preferences:
128.42 ms | 403 KiB | 175 Q