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); var_dump($data); if (json_last_error() !== JSON_ERROR_NONE) { $data = $redisData; } var_dump($data);
based on LXKgk
Output for 5.5.0 - 7.1.7
object(stdClass)#1 (2) { ["transactionId"]=> string(12) "Sok234141341" ["gaClientId"]=> string(14) "41233412.31231" } object(stdClass)#1 (2) { ["transactionId"]=> string(12) "Sok234141341" ["gaClientId"]=> string(14) "41233412.31231" }