NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Need code quick! 25 NP$! **URGENT**

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-05-2005, 09:43 AM THREAD STARTER               #1 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)

Caution Need code quick! 25 NP$! **URGENT**


hey,

I need a quick PHP code that does this:

Finds whether a hyphen is the FIRST character in a string OR LAST character.

E.g. It displays an error for this:

-test

And this:

test-

But not this:

te-st

or....

tes-t

Etc. Just first and last character. 25 NP$ to the person who can write up this PHP code real quick, I can't figure it out for some reason.

Thanks,
-Matt
mholt is offline  
Old 11-05-2005, 07:21 PM   #2 (permalink)
NamePros Member
Join Date: Jul 2005
Posts: 100
Le Wolf is on a distinguished roadLe Wolf is on a distinguished road
 



if(substr($var, -1, 1) == '-' OR substr($var, 0, 1) == '-') {
echo "Error";
}
__________________
My host is better than yours
Le Wolf is offline  
Old 11-05-2005, 07:31 PM   #3 (permalink)
NamePros Regular
 
Palyriot's Avatar
Join Date: Jul 2004
Location: Seattle, Wa
Posts: 596
Palyriot is a jewel in the roughPalyriot is a jewel in the roughPalyriot is a jewel in the rough
 



wouldn't you have to find the total chars in the word first, then look back 1?
Palyriot is offline  
Old 11-06-2005, 01:06 AM   #4 (permalink)
NamePros Regular
Join Date: Feb 2004
Location: Student @ UConn
Posts: 411
gamex has a spectacular aura aboutgamex has a spectacular aura about
 



Look at http://us2.php.net/substr
__________________
Joe
gamex is offline  
Old 11-06-2005, 01:24 AM   #5 (permalink)
NamePros Regular
 
Palyriot's Avatar
Join Date: Jul 2004
Location: Seattle, Wa
Posts: 596
Palyriot is a jewel in the roughPalyriot is a jewel in the roughPalyriot is a jewel in the rough
 



Yah, you got it. Sorry.
Palyriot is offline  
Old 11-06-2005, 04:47 PM THREAD STARTER               #6 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Le Wolf has got it Works. 25 NP$ sent.
mholt is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
120 NP$ Logo Contest (Quick Contest!) ClutchCut Design Contests 13 10-20-2005 03:23 PM
Quick! - Small flash header animation needed - NP$ 145 Virgil Design Contests 4 07-21-2005 03:23 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 03:51 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger