jsjohnst                Wed Mar  9 22:52:30 2005 EDT

  Modified files:              
    /phpdoc/en/reference/strings/functions      stristr.xml 
  Log:
  Cleaned up the existing example to make it a little more clear and added two 
more examples to 
  make the usage better understood. Deleting inaccurate notes as well which 
prompted the new examples.
  
  
http://cvs.php.net/diff.php/phpdoc/en/reference/strings/functions/stristr.xml?r1=1.8&r2=1.9&ty=u
Index: phpdoc/en/reference/strings/functions/stristr.xml
diff -u phpdoc/en/reference/strings/functions/stristr.xml:1.8 
phpdoc/en/reference/strings/functions/stristr.xml:1.9
--- phpdoc/en/reference/strings/functions/stristr.xml:1.8       Thu Jul 22 
18:51:12 2004
+++ phpdoc/en/reference/strings/functions/stristr.xml   Wed Mar  9 22:52:29 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
 <!-- splitted from ./en/functions/strings.xml, last change in rev 1.8 -->
   <refentry id="function.stristr">
    <refnamediv>
@@ -35,14 +35,43 @@
 <![CDATA[
 <?php
   $email = '[EMAIL PROTECTED]';
-  $domain = stristr($email, 'e');
-  echo $domain; 
+  echo stristr($email, 'e');
 // outputs [EMAIL PROTECTED]
 ?>
 ]]>
       </programlisting>
      </example> 
     </para>
+    <para>
+     <example>
+      <title>Testing if a string is found or not</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+  $string = 'Hello World!';
+  if(stristr($string, 'earth') === FALSE) {
+    echo '"earth" not found in string';
+  }
+// outputs: "earth" not found in string
+?>
+]]>
+      </programlisting>
+     </example> 
+    </para>
+    <para>
+     <example>
+      <title>Using a non "string" needle</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+  $string = 'APPLE';
+  echo stristr($string, 97); // 97 = lowercase a
+// outputs: APPLE
+?>
+]]>
+      </programlisting>
+     </example> 
+    </para>
 
     &note.bin-safe;
 

Reply via email to