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.

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 use a Hash object, since arrays in Ruby don’t use associative key/value pairs.

Ruby

array = { :go => 'green', :stop => 'red' };
puts array.keys;
# => [:go, :stop]
By | 2010-02-24T12:31:01+00:00 February 24th, 2010|Categories: PHP, Ruby|Tags: , , |Comments Off on array_keys

About the Author: