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 bracket notation with double quotes --SKIPIF-- <?php if (!extension_load..

Decoded Output download

--TEST--
Test dot bracket notation with double quotes
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    "key" => "value",
    "other" => [
        "key" => [
            "key" => 42,
        ],
    ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, '$.["key"]');

var_dump($result);
?>
--EXPECT--
array(1) {
  [0]=>
  string(5) "value"
}

Did this file decode correctly?

Original Code

--TEST--
Test dot bracket notation with double quotes
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    "key" => "value",
    "other" => [
        "key" => [
            "key" => 42,
        ],
    ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, '$.["key"]');

var_dump($result);
?>
--EXPECT--
array(1) {
  [0]=>
  string(5) "value"
}

Function Calls

None

Variables

None

Stats

MD5 ea98168854939a0fa64e2d78d876f715
Eval Count 0
Decode Time 96 ms