3v4l.org

run code in 300+ PHP versions simultaneously
<?php $files = scandir('ftp://ftp.cetip.com.br/MediaCDI/', SCANDIR_SORT_DESCENDING); $newest_file = $files[0]; $fh = fopen($newest_file, 'r'); echo $fh;
Output for 8.3.0 - 8.3.6
Warning: scandir(): php_network_getaddresses: getaddrinfo for ftp.cetip.com.br failed: System error in /in/KrphB on line 2 Warning: scandir(): connect() failed: php_network_getaddresses: getaddrinfo for ftp.cetip.com.br failed: System error in /in/KrphB on line 2 Warning: scandir(ftp://ftp.cetip.com.br/MediaCDI/): Failed to open directory: operation failed in /in/KrphB on line 2 Warning: scandir(): (errno 97): Address family not supported by protocol in /in/KrphB on line 2 Warning: Trying to access array offset on false in /in/KrphB on line 3 Deprecated: fopen(): Passing null to parameter #1 ($filename) of type string is deprecated in /in/KrphB on line 4 Fatal error: Uncaught ValueError: Path cannot be empty in /in/KrphB:4 Stack trace: #0 /in/KrphB(4): fopen('', 'r') #1 {main} thrown in /in/KrphB on line 4
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: scandir(): php_network_getaddresses: getaddrinfo for ftp.cetip.com.br failed: System error in /in/KrphB on line 2 Warning: scandir(): connect() failed: php_network_getaddresses: getaddrinfo for ftp.cetip.com.br failed: System error in /in/KrphB on line 2 Warning: scandir(ftp://ftp.cetip.com.br/MediaCDI/): Failed to open directory: operation failed in /in/KrphB on line 2 Warning: scandir(): (errno 97): Address family not supported by protocol in /in/KrphB on line 2 Warning: Trying to access array offset on value of type bool in /in/KrphB on line 3 Deprecated: fopen(): Passing null to parameter #1 ($filename) of type string is deprecated in /in/KrphB on line 4 Fatal error: Uncaught ValueError: Path cannot be empty in /in/KrphB:4 Stack trace: #0 /in/KrphB(4): fopen('', 'r') #1 {main} thrown in /in/KrphB on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Warning: scandir(): php_network_getaddresses: getaddrinfo failed: System error in /in/KrphB on line 2 Warning: scandir(): connect() failed: php_network_getaddresses: getaddrinfo failed: System error in /in/KrphB on line 2 Warning: scandir(ftp://ftp.cetip.com.br/MediaCDI/): Failed to open directory: operation failed in /in/KrphB on line 2 Warning: scandir(): (errno 97): Address family not supported by protocol in /in/KrphB on line 2 Warning: Trying to access array offset on value of type bool in /in/KrphB on line 3 Fatal error: Uncaught ValueError: Path cannot be empty in /in/KrphB:4 Stack trace: #0 /in/KrphB(4): fopen('', 'r') #1 {main} thrown in /in/KrphB on line 4
Process exited with code 255.
Output for 7.4.26 - 7.4.33
Warning: scandir(): php_network_getaddresses: getaddrinfo failed: System error in /in/KrphB on line 2 Warning: scandir(): connect() failed: php_network_getaddresses: getaddrinfo failed: System error in /in/KrphB on line 2 Warning: scandir(ftp://ftp.cetip.com.br/MediaCDI/): failed to open dir: operation failed in /in/KrphB on line 2 Warning: scandir(): (errno 97): Address family not supported by protocol in /in/KrphB on line 2 Notice: Trying to access array offset on value of type bool in /in/KrphB on line 3 Warning: fopen(): Filename cannot be empty in /in/KrphB on line 4
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25
Warning: scandir(): php_network_getaddresses: getaddrinfo failed: System error in /in/KrphB on line 2 Warning: scandir(): connect() failed: php_network_getaddresses: getaddrinfo failed: System error in /in/KrphB on line 2 Warning: scandir(ftp://ftp.cetip.com.br/MediaCDI/): failed to open dir: operation failed in /in/KrphB on line 2 Warning: scandir(): (errno 97): Address family not supported by protocol in /in/KrphB on line 2 Warning: fopen(): Filename cannot be empty in /in/KrphB on line 4
Output for 5.2.9 - 5.2.17, 5.3.0 - 5.3.29
Warning: scandir() expects parameter 2 to be long, string given in /in/KrphB on line 2 Warning: fopen(): Filename cannot be empty in /in/KrphB on line 4
Output for 5.2.3 - 5.2.8
Warning: scandir() expects parameter 2 to be long, string given in /in/KrphB on line 2
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<br /> <b>Warning</b>: scandir() expects parameter 2 to be long, string given in <b>/in/KrphB</b> on line <b>2</b><br />
Output for 4.4.5 - 4.4.9
<br /> <b>Fatal error</b>: Call to undefined function: scandir() in <b>/in/KrphB</b> on line <b>2</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
<br /> <b>Fatal error</b>: Call to undefined function: scandir() in <b>/in/KrphB</b> on line <b>2</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Call to undefined function: scandir() in <b>/in/KrphB</b> on line <b>2</b><br />

preferences:
294.59 ms | 401 KiB | 468 Q