function containsStr($str, $substr) { return strpos($str, $substr) !== false; }
$a = 'Hello world?';
if (strpos($a, 'Hello') !== false) { //PAY ATTENTION TO !==, not !=
echo 'true';
}
if (stripos($a, 'HELLO') !== false) { //Case insensitive
echo 'true';
}$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
Also in PHP:
- date current time php
- $loop laravel list
- Call to undefined function GuzzleHttp\_idn_uri_convert()
- Failed at the @ development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
- check if string is in another string php
- Allowed memory size of 1610612736 bytes exhausted for laravel
- disable updated_at laravel
- carbon add minutes
- Dynamic title on every page laravel blade
- clear cache laravel on server
- clear in laravel
- creat laravel project
- eventtypeseeder laravel
- edit and add raw http header with php
- PHP Startup: Unable to load dynamic library 'curl'
- Laravel Mix npm run production error
- actual date php
- display off php error
- date en cours php
- array key xists
- check string is present in php
- check if string exist in string php
- date to timestamp ph
- decode ' php