tedd wrote:
At 2:48 PM -0400 5/23/10, Robert Cummings wrote:
tedd wrote:
At 1:02 PM -0400 5/22/10, Robert Cummings wrote:
tedd wrote:
If that is all (i.e., removing double linefeeds), then this will do it:

$text_array = array();
$text_array = explode("\n\n", $input_text);
$output_text = implode("\n",$text_array);
Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system:

$data = preg_replace( "#[\r\n]+#", PHP_EOL, $input );


It's not broken according to my "given", which was "If that is all (i.e., removing double linefeeds), then this will do it:" My code does exactly what was stated.
Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :)


Okay, so I didn't correctly identify and understand the problem from the client (the list), but my solution worked for the problem I understood.


Doh, what's funny is I fixed it in my test script but had already pasted into my email and forgot to update that *lol*. Good catch!

You correctly identified and understood the problem, but failed to provide a working solution to the client (the list).

It's a good thing that we both have clients who understand we're not prefect. :-)

Let's just agree that we both can identify, understand, and solve such minor problems.

If you had been a real client I would have tested before shipping :) My problem would have been caught immediately, yours could have been silently wreaking havoc my altering data. I'd rather a completely broken solution than a half working solution that presents itself at a later time :|

The only reason I bothered to bring it up though, is because these miscommunications between client and developer (and any number of in betweens was the focus of a memorable cartoon that our professor presented to all of us in a second year programming course (Prgramming in the Large with C++). It highlighting the conceptual differences between different people in the production chain and how the client pretty mich didn't get what he wanted :)

E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to