- var_dump: documentation ( source)
- asort: documentation ( source)
<?php
class _Stringable {
public $value;
public function __construct($value) {
$this->value = $value;
}
public function __toString() {
return $this->value;
}
}
class NonStringable {
public $value;
public function __construct($value) {
$this->value = $value;
}
}
$items = array(
new _Stringable('A'),
new _Stringable('B'),
new NonStringable('C')
);
asort($items);
var_dump($items);