check if string contains 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';
}if (strpos($string, 'substring') !== false) {
// do stuff
}$a = 'Hello world?';
if (strpos($a, 'Hello') !== false) { //PAY ATTENTION TO !==, not !=
echo 'true';
}
if (stripos($a, 'HELLO') !== false) { //Case insensitive
echo 'true';
}$result = strpos("haystack", "needle");
if ($result != false)
{
// text found
}$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
Also in PHP:
- acheck key exist in array php
- clear nuget cache
- Difference in days of two dates in php
- explode in php
- Reading a Tree of Files and Folders in php
- catching errors in php
- check if a string contain a substring php
- executer page php via boutton
- echo errors php
- Notice: Undefined variable: _SESSION in C:\xampp\htdocs\practice\header.php on line 7
- check string contain symbol in php
- am pm in php
- date convert timestamp to date php
- echo all error
- 0 is not inger is in php
- ( ! ) Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /Users/chakma/demo/vokuro/app/controllers/UsersController.php on line 375
- check typo of variable php
- count php string
- check strpos in php
- check if substring is present in string php
- eloquent get query log
- In Connection.php line 664:SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema
- apache display php errors
- check php for errors