Re: arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You must do it manually

For concating, try using this function

function concat ( $arr1, $arr2 ) {
  $res = $arr1;
  $c = count ( $res );
  whlie ( list ($k,$v) = @each ($arr2) ) {
     $res[$c] = $v;
     $c++;
  }
  return $res;
}

$data1 = concat ( $data1, $data2 );

For sorting is quite similar.

Hope it helps!

Hernan
 --- Andres Santos <asantos@xxxxxxxxx> escribió:

> hi,
> i have this array:
> 
> $data1[0]['title'] = "hello world";
> $data1[0]['timestamp'] = 12345678;
> $data1[0]['data'] = "this is a test!";
> $data1[1]['title'] = "hello world again";
> $data1[1]['timestamp'] = 87654321;
> $data1[1]['data'] = "this is a test again!";
> 
> and then i have this other array:
> 
> $data2[0]['title'] = "hello world!!!!!!";
> $data2[0]['timestamp'] = 871428741;
> $data2[0]['data'] = "this is anooother test!";
> $data2[1]['title'] = "hello world again!!!??";
> $data2[1]['timestamp'] = 371441412;
> $data2[1]['data'] = "this is another test, again!";
> 
> ...........
> i need to
> 
> 1st) append the second array to the first one in a
> new array called $result
> 2nd) resort the $result array by the timestamp.
> 
> already tried a lot, but i keep getting problems
> with the array stuff.
> any ideas?
> 
> thanks for your time,
> andres
> 
> 
> --
> Slds,
> Andrés Santos, IIG
> 
> ******************************
> móvil: (593) 9 7026627
> e-sw: www.egobits.com
> blogs: www.egoblogs.net
> ******************************
> 


Hernán Mauricio Velásquez
Ingeniero Sistemas y Computación
Universidad de los Andes
Santafé de Bogotá

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux