Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/11/2017, 17:43
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 10 meses
Puntos: 379
Respuesta: Transformar array

Tan sencillo como usar un foreach:
Código PHP:
Ver original
  1. $array = [
  2.  
  3. ['26-8-13', 27.79],
  4. ['26-8-13', 27.71],
  5. ['26-8-13', 27.80],
  6. ['27-8-13', 16.00],
  7. ['27-8-13', 16.40],
  8. ['27-8-13', 16.10],
  9.  
  10. ];
  11.  
  12. $transform = [];
  13. foreach($array as $value) {
  14.     [$key, $value] = $value;
  15.     $transform[$key][] = $value;
  16. }
  17.  
  18. print_r($transform);
Igual puedes hacerlo al estilo funcional
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.