现在我在我的字符串上使用它,substr($row->review[$i] , 0, 120)但我想更进一步,在我限制它之后找到最后一个时期并取出所有内容.有任何想法吗?
$a = 'string you got with substr. iwehfiuhewiufh ewiufh . iuewfh iuewhf
iewh fewhfiu h. iuwerfh iweh f.ei wufh ewifh iuhwef';
$p = strrpos($a, '.');
if ($p !== false) // Sanity check, maybe there isn't a period after all.
$a = substr($a, 0, $p + 1 /* +1 to include the period itself */);
echo $a;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1363 次 |
| 最近记录: |