src/Str.php
public function cspn(string $mask, int $start = 0, int $length = null): int
    {
        if ($length === null) {
            $value = \strcspn($this->value, $mask, $start);
        } else {
            $value = \strcspn(
                $this->value,
                $mask,
                $start,
                $length
            );
        }

        return (int) $value;
    }
public function cspn(string $mask, int $start = 0, int $length = null): int
    {
        if ($length === null) {
            $value = \strcspn($this->value, $mask, $start);
        } else {
            $value = \strcspn(
                $this->value,
                $mask,
                $start,
                $length
            );
        }

        return (int) $value;
    }
public function cspn ( string $ mask , int $ start = 0 , int $ length = null ) : int { if ( $ length === null ) { $ value = \ strcspn ( $ this -> value , $ mask , $ start ) ; } else { $ value = \ strcspn ( $ this -> value , $ mask , $ start , $ length ) ; } return ( int ) $ value ; }
Find length of initial segment not matching mask

@param string $mask
@param int $start
@param int $length

@return int
Find length of initial segment not matching mask