3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "アップロード開始!"; //FTPサーバー名 $ftp_server="FTPサーバー名"; //ユーザー名 $ftp_user_name="ユーザー名"; //パスワード $ftp_user_pw="パスワード"; //アップロード先のリモートファイルのパス $remote_file="./"; //アップロードするローカルファイルのパス $local_file= $_FILES['up_file']['tmp_name']; //転送モード $mode=FTP_ASCII; //FTPサーバーに接続 $conn_id = @ftp_connect($ftp_server); //ユーザ名とパスワードでログイン $login_result = @ftp_login($conn_id, $ftp_user_name, $ftp_user_pw); //接続確認 if ((!$conn_id) || (!$login_result)) { return die("FTP接続失敗!"); } else { echo "ユーザー $ftp_user_name として、 $ftp_server に接続しました"; } //ローカルファイルをアップロード $upload = @ftp_put($conn_id, $remote_file, $local_file, $mode); // アップロード状況を確認する if (!$upload) { return die("アップロード失敗!"); } else { echo "$local_file を $remote_file へ アップロードしました"; } //FTP接続終了 ftp_close($conn_id); ?>
Output for 8.3.0 - 8.3.4, 8.3.6 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
アップロード開始! Warning: Undefined array key "up_file" in /in/5IV7M on line 14 Warning: Trying to access array offset on null in /in/5IV7M on line 14 Fatal error: Uncaught Error: Undefined constant "FTP_ASCII" in /in/5IV7M:16 Stack trace: #0 {main} thrown in /in/5IV7M on line 16
Process exited with code 255.
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 アップロード開始! Warning: Undefined array key "up_file" in /in/5IV7M on line 14 Warning: Trying to access array offset on null in /in/5IV7M on line 14 Fatal error: Uncaught Error: Undefined constant "FTP_ASCII" in /in/5IV7M:16 Stack trace: #0 {main} thrown in /in/5IV7M on line 16
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29
アップロード開始! Warning: Undefined array key "up_file" in /in/5IV7M on line 14 Warning: Trying to access array offset on value of type null in /in/5IV7M on line 14 Fatal error: Uncaught Error: Undefined constant "FTP_ASCII" in /in/5IV7M:16 Stack trace: #0 {main} thrown in /in/5IV7M on line 16
Process exited with code 255.
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
アップロード開始! Notice: Undefined index: up_file in /in/5IV7M on line 14 Notice: Trying to access array offset on value of type null in /in/5IV7M on line 14 Warning: Use of undefined constant FTP_ASCII - assumed 'FTP_ASCII' (this will throw an Error in a future version of PHP) in /in/5IV7M on line 16 Fatal error: Uncaught Error: Call to undefined function ftp_connect() in /in/5IV7M:19 Stack trace: #0 {main} thrown in /in/5IV7M on line 19
Process exited with code 255.
Output for 7.3.32, 7.4.26
アップロード開始! Warning: Use of undefined constant FTP_ASCII - assumed 'FTP_ASCII' (this will throw an Error in a future version of PHP) in /in/5IV7M on line 16 Fatal error: Uncaught Error: Call to undefined function ftp_connect() in /in/5IV7M:19 Stack trace: #0 {main} thrown in /in/5IV7M on line 19
Process exited with code 255.
Output for 7.3.0 - 7.3.31, 7.3.33
アップロード開始! Notice: Undefined index: up_file in /in/5IV7M on line 14 Warning: Use of undefined constant FTP_ASCII - assumed 'FTP_ASCII' (this will throw an Error in a future version of PHP) in /in/5IV7M on line 16 Fatal error: Uncaught Error: Call to undefined function ftp_connect() in /in/5IV7M:19 Stack trace: #0 {main} thrown in /in/5IV7M on line 19
Process exited with code 255.

preferences:
188.79 ms | 416 KiB | 5 Q