Voting

: max(six, two)?
(Example: nine)

The Note You're Voting On

stealz at op dot pl
12 years ago
To get ALL traits including those used by parent classes and other traits, use this function:

<?php
function class_uses_deep($class, $autoload = true) {
$traits = [];
do {
$traits = array_merge(class_uses($class, $autoload), $traits);
} while(
$class = get_parent_class($class));
foreach (
$traits as $trait => $same) {
$traits = array_merge(class_uses($trait, $autoload), $traits);
}
return
array_unique($traits);
}
?>

<< Back to user notes page

To Top