Today, We want to share with you php strpos.In this post we will show you php substr, hear for PHP find string in string we will give you demo and example for implement.In this post, we will learn about How To Check If String Contains A Substring In PHP with an example.
php strpos
Contents
Example : 1 PHP strpos() Function
<!DOCTYPE html> <html> <body> <?php echo strpos("I kiss pakainfo, I kiss pakainfo too!","pakainfo"); ?> </body> </html>
Example : 2 stripos() in PHP
<?php function Search($search, $marketing){ $position = stripos($marketing, $search, 5); if ($position == true){ return "Found at posiion " . $position; } else{ return "Not Found"; } } $marketing = "Welcome to GeeksforGeeks"; $search = "geeks"; echo Search($search, $marketing); ?>
Example : 3 php check if string contains word
$myString = 'Welcome MobileZone how are you?'; if (strpos($myString, 'MobileZone') !== false) { echo "My string contains MobileZone"; }
I hope you get an idea about php strpos.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโt forget to share.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.