how to check multiple array elements using in_array() hii guys
i try to check my multiple array value check if condition but doesnt work
here is my code
@if(in_array(['payment','userprofile','complains'],explode(',',$users->enable_feature)))
...............
@elseif(array_intersect('userprofile', explode(',', $users->enable_feature)))
.................
#else
...............
@endif
here is my code single value perfect work but i try to multple value check then return else part how to do it any other function or may be this function
you just swapped in_array and array_intersect
Simply array_intersect will work.
array_intersect(['payment','userprofile','complains'],explode(',',$users->enable_feature))
@if(array_intersect(['payment','userprofile','complains'],explode(',',$users->enable_feature)))
.................
#else
...............
@endif
@sujancse
when i check using array_intersect always return if condition
like my value "userprofile" then return if condition
@if(array_intersect(['payment','userprofile','complains'],explode(',',$users->enable_feature)))
...............
@elseif(array_intersect('userprofile', explode(',', $users->enable_feature)))
.................
@else
...............
@endif
how to check particular value wise condition
Flip it like
@if(in_array('userprofile', explode(',', $users->enable_feature)))
...............
@elseif(array_intersect(['payment','userprofile','complains'],explode(',',$users->enable_feature)))
.................
@else
...............
@endif
@sujancse but this is not right way
for example
@if(in_array('userprofile', explode(',', $users->enable_feature)))
...............
@elseif(array_intersect(['payment','complains'],explode(',',$users->enable_feature)))
................
@elseif(array_intersect(['payment','userprofile','complains'],explode(',',$users->enable_feature)))
.................
@else
...............
@endif
so now how can i do it?
Please sign in or create an account to participate in this conversation.