3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sSecretKey = 'TrueID2015tRUEid'; $json = json_encode(array( "trueid" => "0864073341", "ssoid" => "19041211", "access_token" => "171|1.c31e0e8fe71d8215f1ff95__3600.1442364865- 19041211|7c938d42413cbdcf23500388375", "thaiid" => "5101599032198", "channel" => "trueid", "paytype" => "credit", "total" => "1010.87", "lang" => "th", "payment" => array( "count" => "2", "invoicelist" => array( array( "invoice_number" => "0001392172791881", "invoice_amount" => "320.47", "amount" => "320.47", "company_code" => "RM", "service_number" => "0864073341", "ban_number" => "16652487", "due_date" => "18/10/2015", "bill_month" => "102015" ), array( "invoice_number" => "000139217279xxxx", "invoice_amount" => "660.93", "amount" => "660.93", "company_code" => "AC", "service_number" => "NF0095630I", "ban_number" => "150024746305", "due_date" => "20/10/2015", "bill_month" => "102015" ) ) ) )); $encrypt = fnEncrypt($json, $sSecretKey); function fnEncrypt($sValue, $sSecretKey) { $iv = base64_decode('Jc8EZ9nZPbWZEoV4ad8/CQ=='); $sValue = pkcs5_pad($sValue, mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); $sValue = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $sSecretKey, $sValue, MCRYPT_MODE_CBC, $iv); $sValue = base64_encode($sValue); return $sValue; } function pkcs5_pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); $pad2 = $text . str_repeat(chr($pad), $pad); return $pad2; }
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /in/JnU4k:42 Stack trace: #0 /in/JnU4k(38): fnEncrypt('{"trueid":"0864...', 'TrueID2015tRUEi...') #1 {main} thrown in /in/JnU4k on line 42
Process exited with code 255.
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 Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /in/JnU4k:42 Stack trace: #0 /in/JnU4k(38): fnEncrypt('{"trueid":"0864...', 'TrueID2015tRUEi...') #1 {main} thrown in /in/JnU4k on line 42
Process exited with code 255.
Output for 5.5.0 - 5.5.34, 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Output for 5.5.35 - 5.5.38, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_block_size() in /in/JnU4k on line 42
Process exited with code 255.

preferences:
178.11 ms | 401 KiB | 252 Q