3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_POST = [ 'JsonData' => '[{"firstname":""},{"lastname":""},{"email":""},{"countryCode":""},{"phone":""},{"i_signup_password":""},{"i_signup_password_rep":""},{"email":""},{"i_signin_password":""},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"}]', 'otherdata' => 'otherdata', 'a number' => 8, ]; foreach ($_POST as $key => $value) { $decoded = json_decode($value, true); $newValue = json_last_error() ? $value : $decoded; if (is_array($decoded) && $newValue === array_values($newValue)) { $newValue = array_merge(...$newValue); } var_export($newValue); echo "\n"; }
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.26, 8.0.0 - 8.0.13, 8.1rc1 - rc3
array ( 'firstname' => '', 'lastname' => '', 'email' => '', 'countryCode' => '', 'phone' => '', 'i_signup_password' => '', 'i_signup_password_rep' => '', 'i_signin_password' => '', 'form' => 'd-sys-login', 'process' => 'e-signin', ) 'otherdata' 8

preferences:
26.29 ms | 460 KiB | 5 Q