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)
-   -   PHP guys - im having a brain fart (https://gfy.com/showthread.php?t=665040)

BradM 10-11-2006 11:29 AM

PHP guys - im having a brain fart
 
I need to rewrite a statement and for some reason I am making it too hard to grasp to myself

I have:
Chicken Cheese Waffles
I want to lower case the letters, remove spaces and replace with -

What's the easiest way to do this?

gooddomains 10-11-2006 11:31 AM

Here we go:
echo("chicken-cheese-waffles);

BradM 10-11-2006 11:32 AM

I wasn't specific enough, or maybe you're just being a sarcastic booger.
This is a string. I want to modify the string. :)

Pete-KT 10-11-2006 11:33 AM

sounds like someone is doing homework

BradM 10-11-2006 11:34 AM

No Pete, I'm not.

martinsc 10-11-2006 11:35 AM

Quote:

Originally Posted by gooddomains (Post 11050232)
Here we go:
echo("chicken-cheese-waffles);

:1orglaugh :1orglaugh :1orglaugh

BigBen 10-11-2006 11:35 AM

http://php.net/strtolower
http://php.net/str_replace

dissipate 10-11-2006 11:36 AM

$string = 'Chicken Cheese Waffles'; // or whatever the hell its stored in
strtolower($string); // makes it lowercase
$string = str_replace(" ", "-", $string); // replace spaces with -'s

CaptainHowdy 10-11-2006 11:37 AM

strtolower function??

BradM 10-11-2006 11:39 AM

Thanks dissipate that's exactly it. I appreciate it.

I knew it was easy. Sheeeeesh. :1orglaugh

Kapitan Ivanov II 10-11-2006 11:39 AM

Quote:

Originally Posted by gooddomains (Post 11050232)
Here we go:
echo("chicken-cheese-waffles);

wrong. should be

echo("chicken-cheese-waffles");

you left out a parenthysis.

CaptainHowdy 10-11-2006 11:41 AM

Quote:

Originally Posted by Kapitan Ivanov II (Post 11050314)
wrong. should be

echo("chicken-cheese-waffles");

you left out a parenthysis.

What if he likes the php error messages??

gooddomains 10-11-2006 11:42 AM

Quote:

Originally Posted by dissipate (Post 11050283)
$string = 'Chicken Cheese Waffles'; // or whatever the hell its stored in
strtolower($string); // makes it lowercase
$string = str_replace(" ", "-", $string); // replace spaces with -'s

correct answer

gooddomains 10-11-2006 11:43 AM

Quote:

Originally Posted by CaptainHowdy (Post 11050330)
What if he likes the php error messages??

There must be at least some challenge

Pete-KT 10-11-2006 11:45 AM

homework?

woj 10-11-2006 12:02 PM

Quote:

Originally Posted by gooddomains (Post 11050232)
Here we go:
echo("chicken-cheese-waffles);

:1orglaugh :thumbsup


All times are GMT -7. The time now is 01:16 PM.

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