Str::substringAfter PHP Method

substringAfter() public static method

public static substringAfter ( $haystack, $needle )
    public static function substringAfter($haystack, $needle)
    {
        $pos = strpos($haystack, $needle);
        if (false === $pos) {
            return $haystack;
        }
        return trim(substr($haystack, $pos + strlen($needle)));
    }

Usage Example

Example #1
0
function extract_doc_annotations($comment, $annotation)
{
    $values = [];
    foreach (explode("\n", $comment) as $line) {
        if (!Str::startsWith(trim($line), '* ' . $annotation)) {
            continue;
        }
        $value = Str::substringAfter($line, $annotation);
        if ($value !== '') {
            $values[] = trim($value);
        }
    }
    return $values;
}
All Usage Examples Of Str::substringAfter