Skip to content
Advertisement

Printing upto a specific string when reading from a file in php

I have a text file containing names which i am reading using the file() function in php but when i am trying to stop at certain point when a matching name is found, i am not getting any output. please help.

JavaScript

Advertisement

Answer

Add a rtrim() to remove the newline from $val

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement