3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $transactionId = "Sok234141341"; $gaClientId = "41233412.31231"; $redisData = $transactionId; $redisData = json_encode([ 'transactionId' => $transactionId, 'gaClientId' => $gaClientId ]); $data = json_decode($redisData); $tid = $data['transactionId']; $gid = $data['gaClientId']; var_dump("$tid $gid"); if (json_last_error() !== JSON_ERROR_NONE) { $tid = $data; $gid = null; } var_dump("$tid $gid");
based on KIdD3
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/5sj57:14 Stack trace: #0 {main} thrown in /in/5sj57 on line 14
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Fatal error: Cannot use object of type stdClass as array in /in/5sj57 on line 14
Process exited with code 255.