3v4l.org

run code in 500+ PHP versions simultaneously
<?php echo sscanf('', '%d', $num); // -1 echo "\n"; echo sscanf('foo', '%d', $num); // 0 echo "\n"; echo sscanf('411', '%d', $num); // 1 echo "\n"; echo sscanf('411', '%d%d', $num); // Fatal error: Uncaught ValueError: Different numbers of variable names and field specifiers /* echo "\n---\n"; var_export(sscanf('', '%d')); // null echo "\n"; var_export(sscanf('foo', '%d')); // [null] echo "\n"; var_export(sscanf('411', '%d')); // [411] echo "\n"; var_export(sscanf('411', '%d%d')); // [411, null] */
Output for 8.2.31 - 8.2.32, 8.3.0 - 8.3.32, 8.4.1 - 8.4.23, 8.5.0 - 8.5.8
-1 0 1 Fatal error: Uncaught ValueError: Different numbers of variable names and field specifiers in /in/hbI7n:9 Stack trace: #0 /in/hbI7n(9): sscanf('411', '%d%d', 411) #1 {main} thrown in /in/hbI7n on line 9
Process exited with code 255.

preferences:
50.36 ms | 766 KiB | 4 Q