What does the `array` keyword mean in the parameter list of a PHP function? -


function request($suffix, array $post = array(), $action = null) {     // something... } 

i saw function in book. don't understand keyword array means before $post in parameter list of function. feel omitting array have same effect.

does act data type prompt? if so, why can't use string, integer etc before other parameters?

function request($suffix, array $post = array(), $action = null) {     // something... } 

that function accepts number of parameters, parameter $post type hinted array

array $post = array() 

here can see $post assigned empty array default, conforming type

$post = array() , array $post = array() return same 

if try pass else array argument function errors

type hinting refer more explanation


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -