check if string contains substring 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
}$result = strpos("haystack", "needle");
if ($result != false)
{
// text found
}$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);// returns true if $needle is a substring of $haystack
function contains($haystack, $needle){
return strpos($haystack, $needle) !== false;
}
Also in PHP:
- convert uppercase in php
- clear docker cache
- datetime format laravel
- check if key_exists php
- dynamic carousel bootstrap php
- fetch value from json link in php
- convert multidimensional array to single array php
- data time on php
- composite unique between two columns laravel migration
- check whrew key in array have a value
- To find out where your php.ini is located
- Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". php 8
- display error on screen
- ajax jquery php
- encryption key has not encrypted laravel
- < Php echo date("m") . " "; ?> what is the output of this script?
- array contains key
- adding days in date, php
- enable errors in php
- base64 decode
- create new larael project 7
- array length php
- Laravel store multiple files
- eloquent run seeder