Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why only red is output #100

Open
xcma opened this issue Jun 7, 2023 · 4 comments
Open

Why only red is output #100

xcma opened this issue Jun 7, 2023 · 4 comments

Comments

@xcma
Copy link

xcma commented Jun 7, 2023

//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);
}

@xcma
Copy link
Author

xcma commented Jun 8, 2023

  $fruits = Items::fromString('{"results":[{"color":"red"},{"color":"yellow"}]}', ['pointer' => '/results/-/color']);
    foreach ($fruits as $key => $value) {
        var_dump($value);
    }
    
    output "red" and  "yellow"

@xcma
Copy link
Author

xcma commented Jun 8, 2023

$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" 

@halaxa
Copy link
Owner

halaxa commented Jun 18, 2023

Thanks, I'll try to get to it ASAP.

@halaxa
Copy link
Owner

halaxa commented Jun 18, 2023

Good job with hitting the #💯btw 😂👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants