contains substring php
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}$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
}
Also in PHP:
- Title
- cpanel composer update kill
- Category
- PHP
- Title
- adding 2 in date() php
- Category
- PHP
- Title
- contains in string using php
- Category
- PHP
- Title
- add one day to given date in php
- Category
- PHP
- Title
- activerecord yii2 select with limit(start,end) not working
- Category
- PHP
- Title
- check if array key exists
- Category
- PHP
- Title
- date u php
- Category
- PHP
- Title
- check if string contains a word php
- Category
- PHP
- Title
- Who is known as the father of PHP?
- Category
- PHP
- Title
- array values php
- Category
- PHP
- Title
- array_count_values php
- Category
- PHP
- Title
- datetime mysql php
- Category
- PHP
- Title
- Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:
- Category
- PHP
- Title
- convert long timestamp to date in php
- Category
- PHP
- Title
- do_shortcode not working
- Category
- PHP
- Title
- delete register option laravel 7
- Category
- PHP
- Title
- codeigniter get last inserted data row
- Category
- PHP
- Title
- elevated th in dates format php
- Category
- PHP
- Title
- apt install php7.4-mbstring php7.4-zip php7.4-xml
- Category
- PHP
- Title
- create laravel project without template
- Category
- PHP
- Title
- detect long right click javascript
- Category
- PHP
- Title
- execute php in browser's console
- Category
- PHP
- Title
- create a function that checks the values of the indexes in two arrays and keep a score
- Category
- PHP
- Title
- encode and decode data in php
- Category
- PHP