PHP Strip spaces from string? NOT whitespace!
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
PHP Strip spaces from string? NOT whitespace!
I have a string such as "JAB Creations", what function would I use to strip spaces so the output would be "JABCreations"? Trim looks like it's intended for whitespace removal only.
Re: PHP Strip spaces from string? NOT whitespace!
Code: Select all
Use: str_replace(' ','','Jab Creations')- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: PHP Strip spaces from string? NOT whitespace!
Thanks pcoder, I just found the same suggestion searching online...
I'm basically doing this to construct a file name so I know who uploads what. That way I can give credit to Onion when he uploads free dancing girls for me!
I'm basically doing this to construct a file name so I know who uploads what. That way I can give credit to Onion when he uploads free dancing girls for me!
Code: Select all
<?php
$username = 'JAB Creations';
$filename = strtolower(str_replace(' ', '', $text));
echo $filename;
?>Re: PHP Strip spaces from string? NOT whitespace!
I can do that. What's the URL?JAB Creations wrote:That way I can give credit to Onion when he uploads free dancing girls for me!
Bizarrely enough, just yesterday I came up with an interesting idea for a password protection system that involves dancing. A computer would run an application that takes video footage of you dancing in front of your webcam, and encodes it into a passphrase. Then, if anyone wants access they have to beat you in a dance off. It's quite brilliant. In fact, I think it's the future.
*busts some moves*
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: PHP Strip spaces from string? NOT whitespace!
Ha that's awesome! I'm actually working on polishing up existing features (working on cleaning up file structure this morning) and have to add some other things (the ability to report things in example) before I release my first Beta! I'll be sending PM's to mods when it's ready in a week or two and posting code in the critique forum as well.
Re: PHP Strip spaces from string? NOT whitespace!
Yeah really, it's quite brilliant, I can see the future with groomed technology.
Re: PHP Strip spaces from string? NOT whitespace!
Why?JAB Creations wrote:I'll be sending PM's to mods when it's ready in a week or two
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: PHP Strip spaces from string? NOT whitespace!
First beta will be closed though the source will be posted in the critique forum. I trust you guys and my close friends not to actually start posting dancing girls (being serious now) and to help me with the critical input I'm looking for. I'll be looking for security holes and the like which is why I don't want to test it too heavily. The second beta will be open to everyone when I'm sure things are solid security wise.
Re: PHP Strip spaces from string? NOT whitespace!
Rather than assuming the mods will help why not post a thread in Volunteer Work asking for people to help, and then send the address of the Beta to the ones who offer that you trust. It's flattering that you think we're the ones to send it to, but a few of the mods are pretty busy these days...JAB Creations wrote:I'll be looking for security holes and the like which is why I don't want to test it too heavily.
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: PHP Strip spaces from string? NOT whitespace!
Well the code will be posted in the critique forum for everyone to see. If it looks secure to other people then I might post a link at least here on the forums. If pming mods with a link to check things out would be burdensome then I think I'll stop short of doing that.