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-30T16:12:47+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.

2110, 2009

array_count_values

By | October 21st, 2009|Categories: PHP, Ruby|Tags: , , |Comments Off on array_count_values

The array_count_values() function in PHP counts the number of instances of each value in an array. array_count_values() returns an associative array using the values of the input array as keys and their frequency in the input as values.

PHP

$a = array('a', 'b','a', 'c', 'c');
$results = array_count_values($a);
print_r($results);
/*
Array [...]

1410, 2009

array_shift

By | October 14th, 2009|Categories: PHP, Ruby|Tags: , , |Comments Off on array_shift

The array_shift() function in PHP removes an element from the beginning of an array and returns it.

PHP

$my_array = array('a', 'b', 'c', 'd');
$my_element = array_shift($my_array);
print_r($my_element);
/*
Array (
	[0] => a
)
*/

Ruby

my_array = [ "a", "b", "c", "d" ];
puts my_array.shift;
# => ["a"]
1010, 2009

array_unique

By | October 10th, 2009|Categories: PHP, Ruby|Tags: , , , , |Comments Off on array_unique

The array_unique() function in PHP takes an array and filters our any duplicates values, returning the array with only unique values present.

PHP

$elements = array('php', 'ruby', 'perl', 'php');
array_unique($elements);
print_r($elements);
/*
Array (
	[0] => php
	[1] => ruby
	[2] => perl
)
*/

Ruby

elements = [ "php", "ruby", "perl", "php" ];
puts elements.uniq;
# => ["php", "ruby", "perl"]
710, 2009

array_unshift

By | October 7th, 2009|Categories: PHP, Ruby|Tags: , , , |Comments Off on array_unshift

The array_unshift() function in PHP prepends elements onto the beginning of an array.

PHP

$cue = array('http', 'https', 'ftp');
array_unshift($cue, 'ssh');
print_r($cue);
/*
Array (
	[0] => ssh
	[1] => http
	[2] => https
	[3] => ftp
)
*/

Ruby has an identical Array method, named unshift:

Ruby

cue = [ "http", "https", "ftp" ];
cue.unshift('ssh');
puts cue;
# => [ "ssh", "http", "https", [...]

Autonomous Standing Desk