SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: is numeric
Hybrid View
-
Jun 15, 2001, 13:43 #1
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
is numeric
Whats a good way to test to see if a variable contains only numbers, or text.
I got one variable, and I got to do something different with it depending on whether or not it contains text or numbers.Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Jun 15, 2001, 13:48 #2
- Join Date
- Jul 1999
- Location
- Chicago
- Posts
- 2,629
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think is_numeric() does what you're looking for.
-
Jun 15, 2001, 13:55 #3
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
who'da thunk it
Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Jun 15, 2001, 14:45 #4
- Join Date
- Jan 2001
- Location
- Your basement
- Posts
- 192
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
And people still ask.. "Perl or PHP for the web?"
Perl version: if ($string=~/(0-9*)/g)
PHP version if (is_numeric($string))
I love PHP! (ps. my perl regexp might be bunk :-)
-
Jun 15, 2001, 15:07 #5
- Join Date
- Apr 2001
- Location
- Calgary,AB
- Posts
- 345
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yeah, PHP is nice, but what are the advantages Perl has over PHP? I know php makes it easy to do the hard things with perl but it also makes some of the easy things with perl hard with PHP.
So basically what I'm asking is what should I learn about perl? I'm just a PHP guy. But I want to learn things in other languages that I can't do with PHP. I know a bit of javascript, but then the tutorial started getting into the real scripting and if statements and stuff. So I stopped there because I knew how to do that with PHP.
-
Jun 15, 2001, 15:15 #6
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well I found that PERL is way better for doing mundane server admin tasks, like manipulating files, etc.. especially when invoked from the commandline. But PHP is definitely better for the web stuff.
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jun 15, 2001, 17:51 #7
- Join Date
- Dec 2000
- Location
- Idaho, USA
- Posts
- 452
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I found PERL excellent at file manipulation as freddu said, and it is awesome if you are going to create a webadmin control panel for a website.... because it is more of a true programming language then PHP, it has abroader spectrum of usefullness. Both are wonderfull in their respective fields of use.
Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.
Exbabylon- Professional Internet Services
Bookmarks