Change language

PHP ArrayIterator unserialize () function

Syntax:
void ArrayIterator::unserialize (string $serialized)
Parameters:This function takes one parameter, $serialized,which contains the serialize array iterator object.Return value:this the function returns a serialized ArrayIterator object for an unserialized object.The following programs illustrate the ArrayIterator::unserialize() function in PHP:Program 1:  
// Declare ArrayIterator $arrItr = new ArrayIterator ( arr ay ( ’G’ , ’e’ , ’ e’ , ’k’ , ’ s’ ) );  
// Serialize the element $serialize = serialize ( $arrItr );  
// Show output var_dump ( $serialize );  
// Deserialize the serialization element $unserialize = unserialize ( $serialize );  
// Show result var_dump ( $unserialize );  
?>
Exit:
string (107 ) "C: 13:" ArrayIterator ": 81: {x: i: 0; a: 5: {i: 0; s: 1:" G "; i: 1; s: 1:" e "; i: 2; s: 1: "e"; i: 3; s: 1: "k"; i: 4; s: 1: "s";}; m: a: ​​0: {}} "object (ArrayIterator) # 2 (1) {["storage": "ArrayIterator": private] = > array (5) {[0] = > string (1) "G" [1] = > string (1) "e" [2] = > string (1) "e" [3] = > string (1) "k" [4] = > string (1) "s"}}
Program 2:  
// Declare ArrayIterator $arrItr = new ArrayIterator ( array ( "a" = > "Geeks" , "b" = > "for" , "c" = >
"Geeks" ));  
// Add some elements $arrItr -> append ( "Computer" ); $arrItr -> append ( "Science" ); $arrItr -> append ( "Portal" );  
// Serialize the element $serialize = serialize ( $arrItr );  
// Show output var_dump ( $serialize );  
// deserialize the element $unserialize = unserialize ( $serialize );  
// Show output var_dump ( $unserialize );  
?>
Exit:
string (160 ) "C: 13:" ArrayIterator ": 133: {x: i: 0; a: 6: {s: 1:" a "; s: 5:" Geeks "; s: 1:" b "; s: 3: "for"; s: 1: "c"; s: 5: "Geeks"; i: 0; s: 8: "Computer"; i: 1; s: 7: "Science"; i: 2; s: 6: "Portal";}; m: a: ​​0: {}} "object (ArrayIterator) # 2 (1) {[" storage ":" ArrayIterator ": private] = > array (6) {["a"] = > string (5) "Geeks" ["b"] = > string (3) "for" ["c"] = > string (5) "Geeks" [0] = > string (8) "Computer" [1] = > string (7) "Science" [2] = > string (6) "Portal"}}
Link: https : //www.php.net/manual/en/arrayiterator.unserialize.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method