strstr function demo : strstr « String « PHP






strstr function demo

 
<?php

    $haystack = 'is a test';

    $pos = strstr ($haystack, 'is');

    if (!$pos)
      echo "String not found\n";
    else
      echo "String found: $pos\n";

?>
  
  








Related examples in the same category

1.string strstr ( string haystack, string needle ) finds the first occurrence of a substring inside another string (parameter one)
2.strstr() function returns the remainder of string beginning at the first occurrence.
3.strstr.php
4.strtr() function converts all characters contained in destination to their corresponding character matches in source.
5.strtr.php