strrchr
Find the last occurrence of a specified character in a string
Search for the position of "Shanghai" in the string and return all characters from that position to the end of the string:
<span class="token php language-php"><span class="token delimiter important"><?php</span> <span class="token keyword">echo</span> <span class="token function">strchr</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"I love Shanghai!"</span> <span class="token punctuation">,</span> <span class="token string double-quoted-string">"Shanghai"</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span> <span class="token delimiter important">?></span></span>
Search for the position of "What" in the string and return all characters from that position to the end of the string:
<span class="token php language-php"><span class="token delimiter important"><?php</span> <span class="token keyword">echo</span> <span class="token function">strchr</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"Hello world! What a beautiful day!"</span> <span class="token punctuation">,</span> What <span class="token punctuation">)</span> <span class="token punctuation">;</span> <span class="token delimiter important">?></span></span>
Searches for the position of "o" in the string with the ASCII value of "o" and returns all characters from that position to the end of the string:
<span class="token php language-php"><span class="token delimiter important"><?php</span> <span class="token keyword">echo</span> <span class="token function">strchr</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"Hello world!"</span> <span class="token punctuation">,</span> <span class="token number">101</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span> <span class="token delimiter important">?></span></span>