8 08, 2009

is_numeric

By | 2009-11-07T11:33:46+00:00 August 8th, 2009|Categories: PHP, Ruby|Tags: , , , |3 Comments

The is_numeric() function allows you to check if a particular variable is a numeric string. Numeric strings can consist of a sign, any number of digits, a decimal part and an exponential part.

PHP

$my_string = '+1.998';
var_dump( is_numeric($string1) );
// => true

Ruby

 
def is_numeric?(num)
    true if Float(num) rescue false;
end

my_string = '+1.985';
puts is_numeric?(my_string);
# => true

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.