check for substring in php
$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}$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:
- datetime format
- What parameter should you enable if you wish for your browser to show all errors?
- Codeigniter count query results
- array in array php foreach example
- create new record via model in laravel
- HOW TO GET LAST INSERTED ID FROM TABLE IN SQL IN CODEIGNITER
- datetime php create from timestamp
- error_log wordpress
- do console log in php code
- AWS HTTP error: SSL operation failed with code 1.
- check composer version terminal
- check for substring in php
- echo json php
- array sort unique laravel
- #1146 - Table 'phplessons.super' doesn't exist
- apache php default date format 4 digits
- check if home page wordpress
- acf looping through post types
- Class 'App\Http\Controllers\Auth' not found
- date u 1 day php
- Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://vtl-lab.com/VN/crecc-cms/api/member/register.json. (Reason: CORS request did not succeed).
- Laravel Mix npm run production error
- create database seeder in laravel
- database seeding