GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Quick PHP Project for PayPal? (https://gfy.com/showthread.php?t=1001420)

96ukssob 12-10-2010 11:11 AM

Quick PHP Project for PayPal?
 
I need something built out pretty quick and annoyed that I just spent the last hour trying to figure it out and cant get it to work.

What I need is a text box to dump in a bunch of keywords, separated by line breaks.

When I hit "submit" it will then add find a space " " and replace it with a " +" (space plus sign). As well, it will add a plus sign "+" to the first word; since there is no space before that.

Here is a sample input:

banana hammock
tube sock
purple people peter eater
porn

The output would then be:

+banana +hammock
+tube +sock
+purple +people +peter +eater
+porn

:thumbsup

u-Bob 12-10-2010 11:48 AM

I was here :)

Kiopa_Matt 12-10-2010 11:55 AM

Code:

$lines = explode("\n", $contents);
$new_content = implode("\n", array_map('format_line', $lines));

function format_line($line) {
    $line = '+' . preg_replace("/\s/", "\s+", $line);
    return $line;
}

Or something like that at least should work.

96ukssob 12-10-2010 11:58 AM

Quote:

Originally Posted by u-Bob (Post 17765092)
I was here :)

Thanks!! Your the man :thumbsup

CamsMaster 12-10-2010 12:02 PM

Quote:

Originally Posted by Kiopa_Matt (Post 17765106)
Code:

$lines = explode("\n", $contents);
$new_content = implode("\n", array_map('format_line', $lines));

function format_line($line) {
    $line = '+' . preg_replace("/\s/", "\s+", $line);
    return $line;
}

Or something like that at least should work.

:thumbsup:thumbsup


All times are GMT -7. The time now is 01:46 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123