How do I get the values inside an array?

-1
  0 => {#557 ▼
    +"nis": 1
  }
  1 => {#561 ▼
    +"nis": 16192248487
  } 

I have this array, I want to get the values: 1 and 16192248487 , and throw them in a variable to give dd and print them on the screen and show only: 1 and 16192248487 , the language I use is php with laravel

    
asked by anonymous 06.12.2017 / 14:17

2 answers

0

is an object inside the array, you have to pick with selector, example

foreach($array as $item){
  $var = $item->nis;
}
    
06.12.2017 / 17:07
-2

See if this helps you:

<?php 
$sua_variavel = array();
$seu_array = array(
                array("nis" => 1),
                array("nis" => 16192248487)
             );

foreach($seu_array as $k => $v){   
   $sua_variavel[] = $v;    
}

dd($sua_variavel);
?>
    
06.12.2017 / 17:04