PHP 8.5.0 Alpha 4 available for testing

Voting

: eight plus zero?
(Example: nine)

The Note You're Voting On

celsowm
6 years ago
I've created a dinamic version of grzeniufication code to allow un-, serialize more than one property:

<?php

class Person implements \Serializable {

public
$id;
public
$name;
public
$birthDate;
public
$surname;

public function
serialize() {
return
serialize((array) $this);
}

public function
unserialize($serialized): void {

foreach (
unserialize($serialized) as $p => $v) {
$this->{$p} = $v;
}
}

}

<< Back to user notes page

To Top