30 08, 2009

next

By | 2009-10-15T22:39:14+00:00 August 30th, 2009|Categories: PHP, Ruby|Tags: , , , |Comments Off on next

The next() function in PHP moves the internal array pointer one place forward. However in Ruby, there is no internal array pointer – as such Ruby doesn’t have an equivalent to PHP’s next() function.

27 08, 2009

prev

By | 2009-10-15T22:39:46+00:00 August 27th, 2009|Categories: PHP, Ruby|Tags: , , , |Comments Off on prev

The prev() function in PHP moves the internal array pointer to the previous element (rewinds). However in Ruby, there is no internal array pointer – as such Ruby doesn’t have an equivalent to PHP’s prev() function.

15 08, 2009

is_object

By | 2009-08-12T13:35:16+00:00 August 15th, 2009|Categories: PHP, Ruby|Tags: , , |Comments Off on is_object

The is_object() function allows you to check if a particular variable is an object.

PHP

$obj = new stdClass();
var_dump( is_object($obj) );
// => true

In Ruby we can check if a variable is an object by using the Object#is_a? method – however this will always return true as with Ruby everything (almost) is an object.

Ruby

puts "Hello World".is_a?(Object);
# => true
12 08, 2009

is_string

By | 2009-08-12T13:30:40+00:00 August 12th, 2009|Categories: PHP, Ruby|Tags: , , , , |Comments Off on is_string

The is_string() function allows you to check if a particular variable is a string (type).

PHP

$string1 = 'Hello World';
var_dump( is_string($string1) );
// => true

Ruby

string1 = 'Hello World';
puts string1.is_a?(String);
# => true
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
4 08, 2009

is_int

By | 2009-08-12T12:55:05+00:00 August 4th, 2009|Categories: PHP, Ruby|Tags: , , , , , , |Comments Off on is_int

The is_int() function allows you to check if a particular variable is an integer (type).

PHP

$number = 9.5;
var_dump( is_int($number) );
// => false

Ruby

number = 9.5;
puts number.is_a?(Integer);
# => false
1 08, 2009

is_bool

By | 2009-08-11T15:10:53+00:00 August 1st, 2009|Categories: PHP, Ruby|Tags: , , , , , , |Comments Off on is_bool

The is_bool() function allows you to check if a particular variable is a boolean (type).

PHP

$my_variable = 1;
var_dump( is_bool($my_variable) );
// => false

Ruby

 my_variable = 1;
puts my_variable.is_a?(FalseClass) || my_variable.is_a?(TrueClass)
# => false

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.