3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Returns a string containing the type, and value in prettyfied JSON, of the argument. function pretty ($var) { return gettype($var) . ' ' . json_encode( $var, JSON_UNESCAPED_SLASHES | // Don't escape forward slashes. stripslashes() could be used afterwards instead JSON_UNESCAPED_UNICODE | // Print unicode characters insteas of their encoding "€" vs "\u20ac" JSON_PRETTY_PRINT | // Nice layout over several lines, human readable JSON_PARTIAL_OUTPUT_ON_ERROR | // Substitute whatever can not be printed JSON_INVALID_UTF8_SUBSTITUTE // Convert invalid UTF-8 characters to \0xfffd (Unicode Character 'REPLACEMENT CHARACTER') ); // Constants: https://www.php.net/manual/en/json.constants.php } $argsObj = (object) [ 'operation' => 'acquireNext', 'args' => [ 'workerIntegration' => 1, 'workerType' => '2', 'jobStatus' => 'scheduled' ], 'caller' => __FILE__ . ':' . __LINE__ ]; echo "argsObj: " . pretty($argsObj) . PHP_EOL; print_r($argsObj); var_dump($argsObj); ?>
Output for 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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
argsObj: object { "operation": "acquireNext", "args": { "workerIntegration": 1, "workerType": "2", "jobStatus": "scheduled" }, "caller": "/in/oMsSb:22" } stdClass Object ( [operation] => acquireNext [args] => Array ( [workerIntegration] => 1 [workerType] => 2 [jobStatus] => scheduled ) [caller] => /in/oMsSb:22 ) object(stdClass)#1 (3) { ["operation"]=> string(11) "acquireNext" ["args"]=> array(3) { ["workerIntegration"]=> int(1) ["workerType"]=> string(1) "2" ["jobStatus"]=> string(9) "scheduled" } ["caller"]=> string(12) "/in/oMsSb:22" }
Output for 7.1.25 - 7.1.30
Notice: Use of undefined constant JSON_INVALID_UTF8_SUBSTITUTE - assumed 'JSON_INVALID_UTF8_SUBSTITUTE' in /in/oMsSb on line 11 Warning: A non-numeric value encountered in /in/oMsSb on line 11 argsObj: object { "operation": "acquireNext", "args": { "workerIntegration": 1, "workerType": "2", "jobStatus": "scheduled" }, "caller": "/in/oMsSb:22" } stdClass Object ( [operation] => acquireNext [args] => Array ( [workerIntegration] => 1 [workerType] => 2 [jobStatus] => scheduled ) [caller] => /in/oMsSb:22 ) object(stdClass)#1 (3) { ["operation"]=> string(11) "acquireNext" ["args"]=> array(3) { ["workerIntegration"]=> int(1) ["workerType"]=> string(1) "2" ["jobStatus"]=> string(9) "scheduled" } ["caller"]=> string(12) "/in/oMsSb:22" }

preferences:
194.74 ms | 410 KiB | 5 Q