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";
}
}
精彩评论