PHP collection tool: captures the required content data based on the Start string and end string. The pure PHP function features high performance, no regular expressions, and top-notch efficiency. It supports single truncation or array truncation, if the first group fails to intercept, execute the second set of intercept solutions, and so on... Multiple character encoding formats are supported! $ Str1234567890; var_dump (strCut
PHP collection tool: captures the required content data based on the Start string and end string. The pure PHP function features high performance, no regular expressions, and top-notch efficiency. It supports single truncation or array truncation, if the first group fails to intercept, execute the second set of intercept solutions, and so on... Multiple character encoding formats are supported! $ Str = 1234567890; var_dump (strCut
PHP collection tool: captures the required content data based on the Start string and end string. The pure PHP function features high performance, no regular expressions, and top-notch efficiency. It supports single truncation or array truncation, if the first group fails to intercept, execute the second set of intercept solutions, and so on...
Multiple character encoding formats are supported!
$ Str = '000000 ';
Var_dump (strCutByStr ($ str, '2', '9'); // output 345678
Var_dump (strCutByStr ($ str, array ('A', '4'), array ('B', '7'); // output 56, because the first group of matches are not found, the second group is executed, and so on. <无>
function strCutByStr(&$str, $findStart, $findEnd = false, $encoding = 'utf-8'){if(is_array($findStart)){if(count($findStart) === count($findEnd)){foreach($findStart as $k => $v){if(($result = strCutByStr($str, $v, $findEnd[$k], $encoding)) !== false){return $result;}}return false;}else{return false;}}if(($start = mb_strpos($str, $findStart, 0, $encoding)) === false){return false;}$start += mb_strlen($findStart, $encoding);if($findEnd === false){return mb_substr($str, $start, NULL, $encoding);}if(($length = mb_strpos($str, $findEnd, $start, $encoding)) === false){return false;}return mb_substr($str, $start, $length - $start, $encoding);}