An array of

	echo "<pre>";
	$number = array(3.5.7.11.15);	
	$color = array('blue'.'yellow'.'red');
	echo $color[2] [1];	// A two-dimensional array
	$color[] = 'orange';
	$color[] = 'black';
	$color[] = 'white';//** array subscripts are accumulated according to the largest automatic subscripts
	$color[66] = 'odds';
	print_r($color);// You must print the array with print_r
Copy the code

Practice and output

Key-value pairs

	$student = array(
		'name'= >'Joe'.'age'= >'21'.'height'= >'183.5'.'native'= >'the jining'.'sex'= >'male'
		);
Copy the code

Nesting of arrays

	$students = array(
		array(
		'name'= >'bill'.'age'= >'21'.'height'= >'163.5'.'native'= >'the jining'.'sex'= >'male'
		),
		array(
		'name'= >'Cathy'.'age'= >'21'.'height'= >'153.5'.'native'= >'the jining'.'sex'= >'male'
		),
		array(
		'name'= >'Guo Qian Ren'.'age'= >'21'.'height'= >'183.5'.'native'= >'the jining'.'sex'= >'male'));Copy the code

Foreach outputs an array

foreach ($students as $value) {
	 	echo "Hello everyone, my name is{$value[name]}This year, I{$value[age]}I'm from{$value[native]}I am one{$value[sex]}B: Yes, my height is{$value[height]}Cm < br >";
	
Copy the code

function

function sum($a.$b.$c){
		return $a + $b + $c;
	}
	function di($a.$b){
		return $a - $b;	
	}
	function link($a.$b){
		return  $a.$b."<br>";
	}
	echo sum(1.2.3)."<br>";
	echo di(1.2)."<br>";
	echo link('Hello'.'World');
Copy the code