check if string is 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';
}<?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:
- display picture in pdf generated with laravel
- * @see http://php.net/manual/en/function.date.php
- array key contains php
- Fatal error: Allowed memory size bytes exhausted (tried to allocate bytes)
- eloquent firstOrCreate
- base64 decode encode php
- error php code
- check is front page wordpress
- count number of characters in a string in php
- character length in php
- $b = strpos($line,$start); $a = strpos($line,$end,$b+9);
- codeigniter where_not_in
- associative array in one key in value must unique in array check in php
- explain Y-m-d H:i:s.u
- 1071 specified key was too long max key length is 1000 bytes ) larAVEL
- convert date time to timestamp php
- What parameter should you enable if you wish for your browser to show all errors?
- clean laravel
- date parameter in php
- Notice: Array to string conversion php
- carbon check sunday
- DATE_FORMAT(STR_TO_DATE
- check for str in str php
- connection error php default exception code