开发者

How to print a String after another String?

Hi How can i print an String after another String? This is my file for reading:

members.txt

Name: john
Family: Bell

Name: max
Family: King

i want Only Print string aft开发者_如何学JAVAer "Name: " What should i do? i mean Name: john is one string and want to print string after "Name: "


foreach (file('members.txt') as $line) {
    if (strpos($line, 'Name:') !== FALSE) {
        echo trim(substr($line, 6))."\n";
    }
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜