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 number on object --SKIPIF-- <?php if (!extension_loaded("j..

Decoded Output download

--TEST--
Test dot notation with number on object
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    "a" => "first",
    "2" => "second",
    "c" => "third",
];

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

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

Did this file decode correctly?

Original Code

--TEST--
Test dot notation with number on object
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    "a" => "first",
    "2" => "second",
    "c" => "third",
];

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

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

Function Calls

None

Variables

None

Stats

MD5 9a949f614c2ba49609d74789af459c66
Eval Count 0
Decode Time 84 ms