find substring in string php
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}$result = strpos("haystack", "needle");
if ($result != false)
{
// text found
}<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}
?>
Also in PHP:
- debugbar:clear in laravel
- create random password in php
- destrroy a session php
- check aall routes laravel
- PHP copy table from one database to another
- date month php
- check length of a string in php
- Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". You are running 7.2.33.
- check if word belongs in string
- decrypt base64 php
- check if key exists array php
- check method in laravel
- PHP DATE 2019-10-01 FORMAT
- check version of php using composer
- console print in php
- capitalize all letters php
- 4 letters of the months of the year php
- Allowed memory size of 1610612736 bytes exhausted larave lvalet composer
- date format in php function
- check if contains substring php
- base64 file php
- display off php error
- base64 php
- cron job for backup in laravel 5.4