| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| DNOA Member | 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
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #2 (permalink) |
| NamePros Member | if(substr($var, -1, 1) == '-' OR substr($var, 0, 1) == '-') { echo "Error"; }
__________________ My host is better than yours |
| |
| | #4 (permalink) |
| NamePros Regular | Look at http://us2.php.net/substr |
| |
| | #6 (permalink) |
| DNOA Member | Le Wolf has got it Works. 25 NP$ sent.
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
![]() |
| 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 02:23 PM |
| Quick! - Small flash header animation needed - NP$ 145 | Virgil | Design Contests | 4 | 07-21-2005 02:23 PM |