I have an array that looks like this:
{"permissions":["1","2"]}
I'm trying to check if a given string is in the permissions array with the following function
function hasPermission($permission) {
return in_array($permission, array_column($this->permissions, 'permissions'));
}
When calling the function giving it the string "1" it return false even though 1 is in the permissions array
Any help would be appreciated
Thanks
EDIT
Here is a var Dump of the converted array
array(1) {
["permissions"]=>
array(2) {[0]=> string(1) "1"
[1]=> string(1) "2"
}
}