vendredi 26 mai 2017

Getting key with a list of arrays

How do i get the key of the Year-month return by my query:

array:5 [▼
  "2017 - Jan" => array:1 [▶]
  "2017 - Feb" => array:2 [▶]
  "2017 - Mar" => array:3 [▶]
  "2017 - Apr" => array:6 [▶]
  "2017 - May" => array:30 [▶]
]

I tried using this method but it returns an error:

foreach(.....) {
    $tourist_yearly_incentive_list->year_month = key($yearly_incentive[$key]); 
}

and gives me an error 'Undefined index: 2017 - Jan'



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rH3ltH
via IFTTT

Aucun commentaire:

Enregistrer un commentaire