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 array slice with open start and negative step --SKIPIF-- <?php if (!extensio..

Decoded Output download

--TEST--
Test array slice with open start and negative step
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    "first",
    "second",
    "third",
    "forth",
    "fifth",
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, '$[:2:-1]');

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

Did this file decode correctly?

Original Code

--TEST--
Test array slice with open start and negative step
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$data = [
    "first",
    "second",
    "third",
    "forth",
    "fifth",
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, '$[:2:-1]');

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

Function Calls

None

Variables

None

Stats

MD5 13f0b5df6c1a6c75d62c5c82dd7f0977
Eval Count 0
Decode Time 100 ms