The situation is as follows:
There's a numerical array containing associative arrays. These associative arrays have 2 elements named "anfang" and "ende".
I'm now using a foreach loop to loop through the numerical array, and inside the foreach loop I want to access the associative elements, it looks like this
foreach($allReservationsOrRequestsByUser as $singleRequestOrReservationByUser){
if(singleRequestOrReservationByUser["start"] > singleRequestOrReservationByUser["end"]{
//do something
}
}
Now, I'm getting the following error message into my apache2 error log
[Mon Feb 04 11:23:16.018026 2019] [:error] [pid 1947] [client 127.0.0.1:41342] PHP Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /var/www/html/include/Dauerreservierung/checkForOverlapWithExistingRequestsOrReservations.php:19 Stack trace: #0 /var/www/html/include/Dauerreservierung/checkForOverlapWithExistingRequestsOrReservations.php(5): mainframe(Array) #1 {main} thrown in /var/www/html/include/Dauerreservierung/checkForOverlapWithExistingRequestsOrReservations.php on line 19, referer: http://localhost/view/dauerreservierung.php `
I don't really understand what the problem is. I've been doing this all the time on my backend in other places and it always worked. This is the first time I see this error. I also tried out var_dump on a single element, like this:
var_dump($allReservationsOrRequestsByUser[0]["anfang"];
And I get the same error. It seems like something is wrong with the array, but I don't understand what it is because I didn't really do anything much different from earlier.
EDIT:
The complete dump Im getting when outputting the full array is:
array(1) {
[0]=>
object(stdClass)#2 (2) {
["anfang"]=>
string(19) "2019-01-23 00:00:00"
["ende"]=>
string(19) "2019-01-30 00:00:00"
}
}