mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
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. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@181752 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
6f48276019
commit
2a7f9c9533
1 changed files with 32 additions and 3 deletions
|
@ -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,10 +35,39 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
$email = 'USER@EXAMPLE.com';
|
||||
$domain = stristr($email, 'e');
|
||||
echo $domain;
|
||||
echo stristr($email, 'e');
|
||||
// outputs ER@EXAMPLE.com
|
||||
?>
|
||||
]]>
|
||||
</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>
|
||||
|
|
Loading…
Reference in a new issue