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 union with keys after array slice --SKIPIF-- <?php if (!extension_loaded("js..

Decoded Output download

--TEST--
Test union with keys after array slice
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    [
        "c" => "cc1",
        "d" => "dd1",
        "e" => "ee1",
    ],
    [
        "c" => "cc2",
        "d" => "dd2",
        "e" => "ee2",
    ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$[:]['c','d']");

var_dump($result);
?>
--EXPECT--
array(4) {
  [0]=>
  string(3) "cc1"
  [1]=>
  string(3) "dd1"
  [2]=>
  string(3) "cc2"
  [3]=>
  string(3) "dd2"
}

Did this file decode correctly?

Original Code

--TEST--
Test union with keys after array slice
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    [
        "c" => "cc1",
        "d" => "dd1",
        "e" => "ee1",
    ],
    [
        "c" => "cc2",
        "d" => "dd2",
        "e" => "ee2",
    ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$[:]['c','d']");

var_dump($result);
?>
--EXPECT--
array(4) {
  [0]=>
  string(3) "cc1"
  [1]=>
  string(3) "dd1"
  [2]=>
  string(3) "cc2"
  [3]=>
  string(3) "dd2"
}

Function Calls

None

Variables

None

Stats

MD5 50123610c575b72f02615872faaf70d4
Eval Count 0
Decode Time 88 ms