php - ErrorException [ Warning ]: Invalid argument supplied for foreach() -


i trying sort array value in ascending order , again need print values in user screen.

views.php

$event_array =  (array)$events; $sorted_value = asort($event_array);  foreach($sorted_value $event): if($event->event_date >= $cdate): 

update:

$event_array =  (array)$events; $sorted_value = asort($event_array);  foreach($events $key => $val):     echo "$key = $val->event_from_time\n"; if($val->event_date >= $cdate): $color = '#ffffff';     $textcolor = '#38cbf0';    else:     $color = '#ffffff';    $textcolor = '#38cbf0';    endif;   $userid_count = $val->event_members_count; 

i getting error in foreach loop "errorexception [ warning ]: invalid argument supplied foreach()"

1st thing sorting code used correct or incorrect.

i need iterate sorted array , display result user.how solve exception.

thanks


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -