1.2.622. Is_A() With String¶
When using is_a() with a string as first argument, the third argument is compulsory. The third argument is $allow_string
, and is necessary to work on strings.
<?php
// is_a() works with string as first argument, when the third argument is 'true'
if (is_a('A', 'B', true)) {}
// is_a() works with object as first argument
if (is_a(new A, 'A')) {}
?>
See also is_a.
1.2.622.1. Connex PHP features¶
1.2.622.1.1. Suggestions¶
Add the third argument, and set it to true
Use an object as a first argument
1.2.622.1.2. Specs¶
Short name |
Php/IsAWithString |
Rulesets |
|
Exakat since |
1.9.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |