You are here : phpstringstristr

stristr() - string

Returns all of haystack starting from and including the first
   occurrence of needle to the end.
Parameters :
  • haystack - The string to search in
  • needle - If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
  • before_needle - If TRUE, stristr() returns the part of the haystack before the first occurrence of the needle (excluding needle).

  • Syntax

    string stristr
        ( string $haystack
       , mixed $needle
       [, bool $before_needle = false
      ] )


    Example

    <?php  $email = 'USER@EXAMPLE.com';  echo stristr($email, 'e'); // outputs ER@EXAMPLE.com  echo stristr($email, 'e', true); // As of PHP 5.3.0, outputs US?>


    Output / Return Value


    Limitations


    Alternatives / See Also


    Reference