3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fd = fopen("php://memory", "w+"); ftruncate($fd, -1);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught ValueError: ftruncate(): Argument #2 ($size) must be greater than or equal to 0 in /in/k720s:4 Stack trace: #0 /in/k720s(4): ftruncate(Resource id #5, -1) #1 {main} thrown in /in/k720s on line 4
Process exited with code 255.
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: ftruncate(): Negative size is not supported in /in/k720s on line 4
Output for 5.6.26 - 5.6.30, 7.0.11 - 7.0.20
Output for 7.0.0 - 7.0.10
Fatal error: Out of memory (allocated 2097152) (tried to allocate 18446744073709551615 bytes) in /in/k720s on line 4 mmap() failed: [22] Invalid argument mmap() failed: [22] Invalid argument
Process exited with code 255.
Output for 5.2.3 - 5.2.17, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.25
Fatal error: Out of memory (allocated 262144) (tried to allocate 18446744073709551615 bytes) in /in/k720s on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Out of memory (allocated 786432) (tried to allocate 18446744073709551615 bytes) in /in/k720s on line 4
Process exited with code 255.
Output for 5.2.2
Fatal error: Out of memory (allocated 262144) (tried to allocate -1 bytes) in /in/k720s on line 4
Process exited with code 255.
Output for 5.1.4 - 5.1.6, 5.2.0 - 5.2.1
Warning: ftruncate(): Can't truncate this stream! in /in/k720s on line 4
Output for 4.3.3 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Success in /in/k720s on line 3 Warning: ftruncate(): supplied argument is not a valid stream resource in /in/k720s on line 4
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/k720s on line 3 Warning: ftruncate(): supplied argument is not a valid stream resource in /in/k720s on line 4
Output for 4.3.0 - 4.3.1
Warning: fopen(php://memory) [http://www.php.net/function.fopen]: failed to create stream: Inappropriate ioctl for device in /in/k720s on line 3 Warning: ftruncate(): supplied argument is not a valid stream resource in /in/k720s on line 4

preferences:
253.96 ms | 401 KiB | 381 Q