PHP strchr() Function

PHP str_word_count() Function
PHP strcmp() Function

what is the syntax of the STRCHR() function in php?

strchr(string,search,before_search);
ParameterDescription
stringRequired. Specifies the string to search
searchRequired. Specifies the string to search for. If this parameter is a number, it will search for the character matching the ASCII value of the number
before_searchOptional. A boolean value whose default is “false”. If set to “true”, it returns the part of the string before the first occurrence of the search parameter.
PHP STRCHR() method

examples of the STRCHR() function in php

Example 1. In this example, we find the first occurrence of “world” inside “Hello world!” and return the rest of the string.

<?php
echo strchr("Hello world!","world");
?>

Example 2. In this example, we search a string for the ASCII value of “o” and return the rest of the string.

<?php
echo strchr("Hello world!",111);
?>

Example 3. In this example, we return the part of the string before the first occurrence of “world”.

<?php
echo strchr("Hello world!","world",true);
?>
PHP str_word_count() Function
PHP strcmp() Function
en English
X
Scroll to Top