[ create a new paste ] login | about

Link: http://codepad.org/dVpDDCcl    [ raw code | output | fork ]

PHP, pasted on Sep 26:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

function addSubCategories( $props = array() )
{
	$props = array_merge_recursive(array(
		'parentCategory' => 'defaultParent',
		'subCategories' => array(
			'defaultName'
		)
	), $props);

	print_r($props);
}

addSubCategories(array(
	'parentCategory' => 'Technology',
	'subCategories' => array(
		'iPods'
	)
));


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Array
(
    [parentCategory] => Array
        (
            [0] => defaultParent
            [1] => Technology
        )

    [subCategories] => Array
        (
            [0] => defaultName
            [1] => iPods
        )

)


Create a new paste based on this one


Comments: