Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Test dot notation with wildcard on object --SKIPIF-- <?php if (!extension_loaded(..

Decoded Output download

--TEST--
Test dot notation with wildcard on object
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php
require_once __DIR__ . '/../utils/sort_recursively.php';

$data = [
    "some" => "string",
    "int" => 42,
    "object" => [
        "key" => "value",
    ],
    "array" => [
        0,
        1,
    ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$.*");
sortRecursively($result);

var_dump($result);
?>
--EXPECT--
array(4) {
  [0]=>
  array(1) {
    ["key"]=>
    string(5) "value"
  }
  [1]=>
  array(2) {
    [0]=>
    int(0)
    [1]=>
    int(1)
  }
  [2]=>
  int(42)
  [3]=>
  string(6) "string"
}

Did this file decode correctly?

Original Code

--TEST--
Test dot notation with wildcard on object
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php
require_once __DIR__ . '/../utils/sort_recursively.php';

$data = [
    "some" => "string",
    "int" => 42,
    "object" => [
        "key" => "value",
    ],
    "array" => [
        0,
        1,
    ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$.*");
sortRecursively($result);

var_dump($result);
?>
--EXPECT--
array(4) {
  [0]=>
  array(1) {
    ["key"]=>
    string(5) "value"
  }
  [1]=>
  array(2) {
    [0]=>
    int(0)
    [1]=>
    int(1)
  }
  [2]=>
  int(42)
  [3]=>
  string(6) "string"
}

Function Calls

None

Variables

None

Stats

MD5 08bf51854af074688d75b1ab148c2732
Eval Count 0
Decode Time 89 ms