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.
Home 2017-05-17T16:03:27+00:00

Convert PHP code into Ruby!

Find out how to change PHP code into Ruby code using PHP to Ruby as your converter. We are on a quest to provide a conversion resource for PHP developers looking to migrate their code to Ruby. Every standard PHP function will be ported to show how it can be done in Ruby. If you find a PHP function which has not been converted yet, feel free to help us out by submitting conversion code yourself.

2703, 2010

call_user_func

By | March 27th, 2010|Categories: PHP, Ruby|Tags: , |Comments Off on call_user_func

The call_user_func() function in PHP calls a user defined function as specified by the first parameter. You can also use call_user_func() to call an instance method of an object by using an array(instance, methodName) parameter as follows:

PHP

class User{
private $name = null;

public function __construct($name){
[...]

2402, 2010

array_keys

By | February 24th, 2010|Categories: PHP, Ruby|Tags: , , |Comments Off on array_keys

The array_keys() function in PHP takes an array as it’s argument and returns all the keys in that array (as a numeric array).

PHP

$array = array('go' => 'green', 'stop' => 'red');
var_dump( array_keys($array) );
/*
Array (
	[0] => go
	[1] => stop
)
*/

To replicate this functionality in Ruby, we need to […]

1702, 2010

array_product

By | February 17th, 2010|Categories: PHP, Ruby|Tags: , , |Comments Off on array_product

The array_product() PHP function returns the product of all values in an array. In other words, it multiplies all values in the array together, and returns the result as a number.

PHP

$a = array('1', '2', '3');
$product_total = array_product($a);
echo $product_total;
// => 6 

Ruby

a = [ "1", "2", "3" [...]

1602, 2010

array_rand

By | February 16th, 2010|Categories: PHP, Ruby|Tags: , , , , , |1 Comment

The array_rand() function in PHP randomly selects one or more elements from an array.

PHP

$users = array('john', 'jane', 'tim', 'alex');
$lucky_winner = array_rand($users);
echo $lucky_winner;
// alex 

Ruby

users = [ 'john', 'jane', 'tim', 'alex' ];
lucky_winner = users[rand(users.length)];
puts lucky_winner;
# => alex 
2510, 2009

array_reverse

By | October 25th, 2009|Categories: PHP, Ruby|Tags: , , |Comments Off on array_reverse

The array_reverse() function in PHP reverses the order of the elements in an array.

PHP

$a = array('php', 'ruby', 'java');
$results = array_reverse($a);
print_r($results);
/*
Array (
	[0] => 'java'
	[1] => 'ruby'
	[2] => 'php'
)
*/

To replicate this functionality in Ruby, we can use the reverse method of the Array object.

Ruby

a = [ "php", "ruby", [...]