0
I am receiving data from a registration form. One of these data is an array...
And this array of objects, (Dates), can have numerous positions/quantities. In the image above, I tested with these 2. I’m trying to do a foreach to get the data that comes in the Dates array, however, I’m not getting it.
With that code:
$dates = $data->dates;
print_r($dates);
foreach($dates as $key){
echo $day = $key->date;
}
and I’m only able to display the dates and united
11/06/202112/06/2021
I need to separate the data as follows:
How can I do that? I’ve been told to use two foreachs, but I’m not making it. From now on, thank you.
I’ll try, thanks Jhonata.
– GustavoSevero
I ran the lines and gave this: "<b>Fatal error</b>: Uncaught Error: Cannot use Object of type stdClass as array in /Applications/MAMP/htdocs/Projects/Web/eudirijo/api/rentcars/Availability.php:29" The 29 line is this below echo 'data_' . $i . ' ' . $key['date'] . '<br>'
– GustavoSevero
Hello, I edited the code, at the time of testing I created arrays instead of Obj. I think now will work in your code! Sorry for the glitch.
– Jhonata De souza