Horje
find in php string or Code Example
find in php string or
$a = 'How are you?';

if (strpos($a, 'are') !== false) {
    echo 'true';
}
strpos in php

<?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";
}
?>

Source: www.php.net
php needle haystack
//Find the position of the first occurrence of a substring in a string
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);
strpos in php

<?php
// We can search for the character, ignoring anything before the offset
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
?>

Source: www.php.net




Php

Related
laravel 8 db like query Code Example laravel 8 db like query Code Example
print array php Code Example print array php Code Example
string to uppercase laravel Code Example string to uppercase laravel Code Example
laravel check if object empty Code Example laravel check if object empty Code Example
how get last item in foreach in laravel Code Example how get last item in foreach in laravel Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7