0

I have an array jobs with fields '['patient']['name']', '['User']['name']', and below is result of array..

Job: Array
(
[0] => Array
    (
        [Patient] => Array
            (
                [name] => Patient1 User
            )

        [User] => Array
            (
                [name] => Alex Lopes
            )

    )

[1] => Array
    (
        [Patient] => Array
            (
                [name] => Patient1 Patient
            )

        [User] => Array
            (
                [name] => Mashal Othman
            )

    )

and so on

how can i retrieve value form specific index i can't use jobs[0] because i want dynamic value....if any one understand my problem please help me

1
  • How are you doing your find? Commented Sep 16, 2013 at 11:24

2 Answers 2

1

Alternatively, you could use array_shift to grab the first element of the array. Throw that into a loop where you check if the array still contains elements and you should be able to get your data

ex:

$arrayCount = count($jobs);
while ($arrayCount > 0) {
   $job = array_shift($jobs);

   // Do your processing here

   $arrayCount = count($jobs);
}
Sign up to request clarification or add additional context in comments.

Comments

1

Did you try Set::extract ? More here http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::extract

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.