Ended up going with a different class to hold flags, and any other settings for it, and then test if it's an instance of that class. Since that class would only be used for this purpose, it works out pretty decently. The example I used now looks like:
class D {
const A = 1;
const B = 2;
const C = 4;
const D = 8;
public function test(){
$args = func_get_args();
$possibly_flags = $args[count($args)-1];
if($possibly_flags instanceof Settings){
// do stuff with the flags
}
}
}
class Settings(){
public $flags;
public function __construct($flags){
$this->flags = $flags;
}
}
$d->test($val1, $val2, [...,], new Settings(D::A|D::B));