Hey Guys,

Sometime I will pass a function an array structured like this: $user
['User']['id'] (the array contains a bunch of other values under the
User key). Other times I will pass the same function an array but with
out the key ($user['id']).

So I use this if statement to get the values:

// @var is an array of user data

function test_for_groups($user) {

                if(isset($user['User'])){
                        $user_id = $user['User']['id'];
                        $company_id = $user['User']['company_id'];
                }else{
                        $user_id = $user['id'];
                        $company_id = $user['company_id'];
                }


What is a better way to do this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to