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 experts how would you do this? (https://gfy.com/showthread.php?t=249502)

Azathoth 03-08-2004 09:40 PM

PHP experts how would you do this?
 
In perl say you did this:

$username =~ tr/[0-9a-zA-Z_\-]//csd;
( This would strip all but alphanumeric chars and _ and - chars )

What would be the equivelant in PHP? I can't seem to find one :helpme

- Az

mike503 03-08-2004 09:47 PM

eregi("^[A-Za-z0-9_-]+$",$foo) is what i use.

so just change that to eregi_replace

$username = eregi_replace("^[A-Za-z0-9_-]+$","",$username)

i didn't like relying on \w or \W (and i think i had some problems with it)

Azathoth 03-08-2004 09:48 PM

Excellent thanks.. I'll give it a shot.

- Az


All times are GMT -7. The time now is 05:41 AM.

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