025-PHP常用字符串函数(二)

<?php
    $text = "My dog's name is Angus.";
    //print Angus
    print(substr($text, 17, 5)."<hr>");//取出子串

    //切开字串
    // create a demo string
    $line = "leon	atkinson	leon@clearink.com";

    // loop while there are still tokens
    for($token = strtok($line, "	");
        $token != "";
        $token = strtok("	"))
    {
        print("token: $token<BR>
");
    }

    //传回字串中某字串开始处至结束的字串
    $text = "Although this is string, it's not very long.";
    print("<hr>".strstr($text, ",")); 
?>

原文地址:https://www.cnblogs.com/tianpan2019/p/10987991.html