0

My Code is :

$result = array();
foreach ($inbox as $key => $p) {
   $group = $result[$p->suratmasuk_id][] = $p;
   foreach ($group as $key => $pp) {
     echo $pp.'<br>';
   }
}

When i var_dump($pp), the result is :

string(2) "25" string(1) "3" string(3) "492" string(2) "75" string(0) "" string(0) "" string(13) "Belum Selesai"

string(2) "26" string(1) "4" string(3) "492" string(2) "75" string(0) "" string(0) "" string(13) "Belum Selesai" 

I just want echo "25" and "26"

How is it? Please help me. Thank you

1 Answer 1

1

just use php array manipulation function, it's easy and short, when your have 2d array

$a = [[25, 22,11], [26, 44, 33]];
print_r(array_column($a, 0));

And when you have key then you can use key instead of array index (0)

Sign up to request clarification or add additional context in comments.

1 Comment

$inbox from me its the query. I use Codeigniter. Please just use my way code. So how to i call the values 25 and 26 ?

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.