PHP Find Specific Word from String Example

03-Apr-2023

.

Admin

PHP Find Specific Word from String Example

Hi Dev,

In this example, you will learn php find specific word from string example. I’m going to show you about how to find specific word from string in php?. This tutorial will give you simple example of find specific word from string in php example. step by step explain how to use function to find specific word from string in php? .

In this example to php find specific word from strings in PHP. in this example, we will use to explode() function used to find specific word. so Let's see the following example with output.

Example: Find Specific Word from String


index.php

<?php

$str = "I am PHP Developer";

// Get Specific Word from string

$strArray = explode(' ',$str);

$result = $strArray[2];

echo $result;

?>

Output:

PHP

I hope it could help you...

#PHP