PHP_Practical_Theory_Questions (2)
PHP_Practical_Theory_Questions (2)
$students = array(
array("Name"=>"John", "Age"=>20),
array("Name"=>"Alice", "Age"=>22),
array("Name"=>"Bob", "Age"=>19)
);
usort($students, function($a, $b) {
return $a['Age'] <=> $b['Age'];
});
print_r($students);
?>
```
**2.6 Cloning**
```php
<?php
class Test {
public $a = 1;
}
$obj1 = new Test();
$obj2 = clone $obj1;
?>
```
**2.7 Serialization**
```php
<?php
$data = array("a"=>1, "b"=>2);
$str = serialize($data);
echo $str;
?>
```