PHPTOM Posted February 13, 2009 Share Posted February 13, 2009 Hi, Basically I have a huge multi-line variable and I want to trim the top line off it. Here is an example: <?PHP $var = "line1 line2 line3 line4"; ?> And I want it just to be <?PHP $var = "line2 line3 line4"; ?> The first line changes, so I cant do explode or anything. Thanks Link to comment https://forums.phpfreaks.com/topic/145117-solved-trim-the-first-line-of-a-variable/ Share on other sites More sharing options...
rhodesa Posted February 13, 2009 Share Posted February 13, 2009 <?php $var = "line1 line2 line3 line4"; $var = preg_replace('/^.*\n/','',$var); print $var; ?> Link to comment https://forums.phpfreaks.com/topic/145117-solved-trim-the-first-line-of-a-variable/#findComment-761633 Share on other sites More sharing options...
PHPTOM Posted February 13, 2009 Author Share Posted February 13, 2009 Great. Thanks! Link to comment https://forums.phpfreaks.com/topic/145117-solved-trim-the-first-line-of-a-variable/#findComment-761637 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.