storing multidimensional array

From: Date: Thu, 01 Nov 2001 20:35:47 +0000
Subject: storing multidimensional array
Groups: php.windows 
Request: Send a blank email to php-windows+get-10157@lists.php.net to get a copy of this message
Hi to all, I created the way to set multidimensional array into database using serialize function. Code looks like: $person = array("afan", "pasalic", "pasa", "123456789"); $home = array("home address comes here", "home city", "home state", "home zip code"); $work = array("work address comes here", "work city", "work state", "work zip code"); $numbers = array("1111", "2222", "3333", "4444", "5555"); $person_ser = serialize($person); $home_ser = serialize($home); $work_ser = serialize($work); $numbers_ser = serialize($numbers); $full_info = array($person_ser, $home_ser, $work_ser, $numbers_ser); $full_info_ser = serialize($full_info); Result is: a:4:{i:0;s:74:"a:4:{i:0;s:4:"afan";i:1;s:7:"pasalic";i:2;s:4:"pasa";i:3;s:9: "123456789";}";i:1;s:108:"a:4:{i:0;s:23:"home address comes here";i:1;s:9:"home city";i:2;s:10:"home state";i:3;s:13:"home zip code";}";i:2;s:108:"a:4:{i:0;s:23:"work address comes here";i:1;s:9:"work city";i:2;s:10:"work state";i:3;s:13:"work zip code";}";i:3;s:81:"a:5:{i:0;s:4:"1111";i:1;s:4:"2222";i:2;s:4:"3333";i:3;s:4 :"4444";i:4;s:4:"5555";}";} it looks ok and "supported". But I would like to know if this is a really correct way or there is better solution? Thanks for any help. Afan

« previous php.windows (#10157) next »