check if substring php
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}<?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";
}
?>
$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}
Also in PHP:
- To find out where your php.ini is located
- check array in array key
- create seede for table in laravel
- array_combine function in php
- convert upper case php
- display errors on
- TEXT UPPER PHP
- error enable in php
- encode image to base64 in php
- create new project laravel
- boucle for php with data
- display errors off php
- convert to format date php
- Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
- codeigniter insert get id
- current data in php
- cusatom time format to timestamp php
- connect mongodb with php
- artisan route:list
- clear cache in laravel in windows cmd
- drupal 8 twig filters
- Allowed memory size of 2147483648 bytes exhausted composer install
- PHP Numbers
- check if string contains a character php