Javatpoint Logo
Javatpoint Logo

PHP string strchr() Function

The string strchr() function is predefined function of PHP. It is the alias of strstr() function or can used to search for the first occurrence of a given string.

Note: This function is case sensitive and binary-safe.

Syntax:

Parameter Description Required/Optional
String Specify the string to search. Required
Search Specify the string to search. If parameter is number then return ASCII value. required
before_search It is false when default value is boolean. If it is true then returns the pars of the string before the first occurrence of the search parameter Optional

Example 1

Output:

PHP

Example 2

Output:

point!

Example 3

Output:

Hello

References:

http://php.net/manual/en/function.strchr.php
Next TopicPHP String





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA