Open xcma opened 1 year ago
$fruits = Items::fromString('{"results":[{"color":"red"},{"color":"yellow"}]}', ['pointer' => '/results/-/color']);
foreach ($fruits as $key => $value) {
var_dump($value);
}
output "red" and "yellow"
$fruits = Items::fromString('{"results":[{"name":"apple","color":"red"},{"name":"pear","color":"yellow"}]}', ['pointer' => '/results/-/color']); foreach ($fruits as $key => $value) { var_dump($value); }
only output "red"
Thanks, I'll try to get to it ASAP.
Good job with hitting the #💯btw 😂👍
//fruitsArray.json { "results": [ { "name": "apple", "color": "red" }, { "name": "pear", "color": "yellow" } ] }
//code $fruits = Items::fromFile('fruitsArray.json', ['pointer' => '/results/-/color']);
foreach ($fruits as $key => $value) { var_dump($value); }