Core Function Combine
From Sputnik Wiki
				
				
				(Difference between revisions)
				
																
				
				
								
				|  (Created page with "<pre> Combine( <array-keys>, <array-values> ) </pre>  === Description ===  Creates a hash (Dictionary) by using the values from the keys array as keys and the values from the val...") | m (1 revision) | ||
| (2 intermediate revisions by one user not shown) | |||
| Line 34: | Line 34: | ||
| $c = combine($a, $b); | $c = combine($a, $b); | ||
| − | foreach($c as $key  | + | foreach($c as $key => $value) | 
| { | { | ||
| 	println("Key: $key <=> Value: $value"); | 	println("Key: $key <=> Value: $value"); | ||
Latest revision as of 12:37, 14 June 2015
Combine( <array-keys>, <array-values> )
| Contents | 
Description
Creates a hash (Dictionary) by using the values from the keys array as keys and the values from the values array as the corresponding values.
Parameters
array-keys
The array to use for keys.
array-values
The array to use for values.
Return Value
Success - Returns new array with merged keys + values.
Failure - Returns empty array.
Remarks
None.
Example
$a = array('green', 'red', 'yellow'); $b = array('avocado', 'apple', 'banana'); $c = combine($a, $b); foreach($c as $key => $value) { println("Key: $key <=> Value: $value"); }
