Answers for "php get value from multidimensional array"

PHP
1

php multidimensional array get all values by key

$ids = array_column($users, 'id');
Posted by: Guest on May-04-2021
0

get the matched value from 2 multidimensional array in php by id

<?php
  $a = Array(
      Array('id' => 1, 'affiliate_id' => 190),
      Array('id' => 2, 'affiliate_id' => 946)
  );

  $b = Array(
      Array('id' => 1, 'user_id' => 190),
      Array('id' => 2, 'user_id' => 246),
      Array('id' => 3, 'user_id' => 249),
      Array('id' => 3, 'user_id' => 250)
  );

  $c = array_map(function ($arr) { return $arr['affiliate_id']; }, $a);
  $d = array_map(function ($arr) { return $arr['user_id']; }, $b);

  $e = array_intersect($c, $d);

  // Output
  // Array ( [0] => 190 )

?>
Posted by: Guest on August-18-2021
0

array in php - multidimintion

Array
(
    [0] => Array
        (
            [0] => Adel
            [1] => mona
            [2] => basant
            [3] => mohamed
            [4] => seif
        )

    [1] => Array
        (
            [0] => Alaa
            [1] => do33a
            [2] => toka
            [3] => yousr
            [4] => eyad
        )

)
Posted by: Guest on June-09-2021

Code answers related to "php get value from multidimensional array"

Browse Popular Code Answers by Language