Welcome Guest, Not a member yet? Register   Sign In
Searching an object for a value (like in_array)
#1

[eluser]tdktank59[/eluser]
Is there a way to do this with objects. Im not sure thus why im asking. Otherwise ill try/use in_array and hope it works lol
#2

[eluser]bretticus[/eluser]
You can use the PHP5 functions get_class_vars() and get_class_methods() to make associative arrays to search in or even use method_exists() or property_exists() to search for them directly.
#3

[eluser]tdktank59[/eluser]
thanks ill give that a try
#4

[eluser]tdktank59[/eluser]
Allright new question!

So ive got an object/array called $this->user_permissions

Heres what it contains

Quote:stdClass Object
(
[role] => stdClass Object
(
[Administrator] => stdClass Object
(
[brainstorms] => stdClass Object
(
[0] => index
[1] => create
[2] => edit
)

[bug] => stdClass Object
(
[0] => index
[1] => solve
)

)

)

[team] => stdClass Object
(
)

[user] => stdClass Object
(
)

[default] => stdClass Object
(
[auth] => stdClass Object
(
[0] => index
[1] => login
[2] => register
)

)

)

I need to search this for $class->$method (both are defined.

where its Type => Class => Method in the array structure above I guess I can go through it but im trying to find a more efficient way to check if I have access




Theme © iAndrew 2016 - Forum software by © MyBB