check string on string php
$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}if (strpos($string, 'substring') !== false) {
// do stuff
}<?php
function g($string,$start,$end){
preg_match_all('/' . preg_quote($start, '/') . '(.*?)'. preg_quote($end, '/').'/i', $string, $m);
$out = array();
foreach($m[1] as $key => $value){
$type = explode('::',$value);
if(sizeof($type)>1){
if(!is_array($out[$type[0]]))
$out[$type[0]] = array();
$out[$type[0]][] = $type[1];
} else {
$out[] = $value;
}
}
return $out;
}
print_r(g('Sample text, [/text to extract/] Rest of sample text [/WEB::http://google.com/] bla bla bla. ','[/','/]'));
?>
results:
Array
(
[0] => text to extract
[WEB] => Array
(
[0] => http://google.com
)
)
Can be helpfull to custom parsing :)
Also in PHP:
- apt install php7.4-mysql
- acf options page
- create seeders in laravel 8
- array de objetos php ejemplos
- date method php
- Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in
- check key array php
- create symbolic in lumen laravel
- ( ! ) Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /Users/chakma/demo/vokuro/app/controllers/UsersController.php on line 375
- apache php e_warnings e_notice off
- decode base 64 php
- array reverse array php
- check if index of array exists php
- convert date and time to timestamp php
- checking type of variable in php
- custom rule laravel validation
- clear single cache laravel 6
- file could not be downloaded: Unable to find the wrap per "https" - did you forget to enable it when you configured PHP? failed to open stream: No such file or directory
- check typeof php
- all cache clear laravel
- array push in php
- associative array in one key in value must unique in array check in php
- comment code in php blade
- base64_decode php online