求字符串最大子串长度
<?php class zif { public function sz($str) { $strsz = str_split($str); $zi = []; $len = []; foreach ($strsz as $val) { if (in_array($val, $zi)) { $c = count($zi); array_push($len, $c); $zi = []; } array_push($zi, $val); } if (!empty($zi)) { $c = count($zi); array_push($len, $c); $zi = []; } return max($len); } } $s = new zif(); $j = $s->sz('qwerghhjhn'); echo $j;