0
Does anyone know any method in PHP that matches the value of a variable with string?
I need to refactor the following code:
public function hasPlan() : bool
{
return $this->reference === 'unico' || $this->reference === 'simultaneo';
}
I would like some tip that returns boolean and tell me that variable $reference
is equal to single string or string' .
And what’s the problem with the current code so you need to refactor it?
– Woss
no problems, but I think it can be improved.
– Adriano Vianna
If you had a PHP method that validated the string, like: method_php($Reference, [unico', 'simultaneo'])
– Adriano Vianna
Reminds me Overengineering , not always less code equals more performance.
– lazyFox