Swear Posted March 18, 2010 Report Share Posted March 18, 2010 Tātad ir dots $teksts kas satur vairākas rindiņas $teksts = 'Rinda 1 Rinda 2 Vel kautkas Un ta talak'; Vajadzētu apstrādāt katru rindiņu piemēram kā ar foreach ($lines as $line_num => $line) bet šis sanāk tikai nolasot failu. Kādi ieteikumi? Quote Link to comment Share on other sites More sharing options...
waplet Posted March 18, 2010 Report Share Posted March 18, 2010 ja ir /n , tad vari explodot string'u un skatīt katru rindiņu. Quote Link to comment Share on other sites More sharing options...
briedis Posted March 18, 2010 Report Share Posted March 18, 2010 Tātad ir dots $teksts kas satur vairākas rindiņas $teksts = 'Rinda 1 Rinda 2 Vel kautkas Un ta talak'; Vajadzētu apstrādāt katru rindiņu piemēram kā ar foreach ($lines as $line_num => $line) bet šis sanāk tikai nolasot failu. Kādi ieteikumi? $arr = explode("\r\n",$teksts); //\r\n vai \n foreach($arr as $line => $item){ echo ($line + 1) . ". rindiņā ir teksts: $item<br />"; } Quote Link to comment Share on other sites More sharing options...
Swear Posted March 18, 2010 Author Report Share Posted March 18, 2010 $arr = explode("\r\n",$teksts); //\r\n vai \n foreach($arr as $line => $item){ echo ($line + 1) . ". rindiņā ir teksts: $item<br />"; } paldies! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.