functions.php ➔ starts_with()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 3
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace API\Helpers;
4
5
function starts_with($haystack, $needle, $case_sensitive = true)
6
{
7
    if ($case_sensitive) {
8
        return strpos($haystack, $needle) === 0;
9
    } else {
10
        return stripos($haystack, $needle) === 0;
11
    }
12
}
13