STORING OBJECTS IN PHP WITH SERIALIZE - .: .: Saiyine :. :.

Storing objects in PHP with serialize

Por Saiyine Enviar correo el 2006-10-25 02:50:27 - Secciones:  PHP ENGLISH  - Enlace permanente: 711

Serialization is the process of converting some object into an easy to manage string, maintaining the ability of inverting the process and obtaining the object back from the string.

So, we could convert database rows into text lines in order to save the changes in a text file, save our program's objects when it ends and recover them at the next run, or create object persistence systems like caches.

With PHP is really easy, because we have the runtime function serialize:

<?
  $vector
["hola"]="Epa{}";
  
$vector["electric"]="Head";

  
print_r($vector);
  
$temporal=serialize($vector);

  echo 
$temporal."\n";
  
$matrix=unserialize($temporal);

  
print_r($matrix);
?>

Output:

Array
(
   [hola] => Epa{}
   [electric] => Head
)
a:2:{s:4:"hola";s:5:"Epa{}";s:8:"electric";s:4:"Head";}
Array
(
   [hola] => Epa{}
   [electric] => Head
)

Otras entradas de la web que podrian interesarte:

o o o o 


Tu nombre (Nick):

Tu correo (Email):
  Necesario para tu gravatar!

Tu página (URL):

Escribe aqui tu comentario:

       :noworry: :roll: :huh: :push: :OO 8) 8O :( :) :? :D :P :o :x :| ;) ^^ xD



Vista previa activada.

Vista previa (6/6/6, 6:66)


Fondos de pantalla

. . .

Recomendamos


. . .

Descargas

  • ApagaPC
    apagapc241.exe  (4337)
  • LimpiaDocus
    LimpiaDocus001.exe  (3624)
  • RCM
    rcm001.zip  (3058)
  • Popmail
    popmail-0.4-psmn.tar.gz  (3132)
  • Manual de Delphi en PDF
    delphi_pdf.zip  (3762)
  • Evangelio del Perl
    Evangelio_del_perl.pdf  (3784)
  • Excel Simpsons
    Excel Simpsons  (3788)
  • . . .

    Proyectos Online

  • Saiyine Store
  • Kunowalls!!!
  • Fondos de pantalla
  • Picaday: imagenes sexys o chocantes.
  • Scarlett: fotos de Scarlett Johansson
  • WhatsmyIP: obtener tu IP pública
  • Uma Thurman: galeria de Uma Thurman
  • FunPics: imagenes graciosas
  • . . .

    Blogs

  • Por lo que más querais, no entreis a estos: Tapanez, Yhandros, Onez.

  • Otros en español: El Mundo Today, La libreta de Van Gaal, Chavalina, Kirai, Mundo Geek, Microsiervos.

  • Mis lecturas en guiri: Michael Yon, Coding Horror, YCombinator news, MySQL Performance, Slashdot.

    . . .
  • Utilidades

  •  Coral  (1582), cacheando webs
  •  Spam.la  (1899), correo de usar y tirar
  •  Mailinator  (1800), correo de usar y tirar
  •  Bug me not  (1580), absurdos registros di NO
  •  Trashmail  (1628), correo de usar y tirar

    . . .

  • Página web ©2001-2011 Saiyine descargada en s, con 5902538 visitas en total, hoy (de un total de 0 previstas).

    . . .