php PHP片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php PHP片段相关的知识,希望对你有一定的参考价值。

<?php

// $answer = 42;
// echo $answer;

// $wizards = array('Harry', 'Ron', 'Hermione'); // indexed array. There are also associative arrays(key/value pairs) and multi-dimenional arrays(array-ception)
// array_push( $wizards, 'Fred', 'George'); // add to the end of an array
// array_pop( $wizards ); // remove last item from an array
// array_shift( $wizards ); // remove first item from an array
// array_unshift( $wizards ); // add a new first item to an array
// unset( $wizards[2] ); // remove a certian index from an array

// echo '<pre>';
// var_dump($wizards);
// echo '</pre>';

// echo 3 == 3;

// function say_hello( $name ) {
//   return "Hey $name, where you goin' with that gun in your hand?";
// }
// $greeting = say_hello( 'Joe' );
// echo $greeting;

function print_pre($input) {
	echo "<pre>";
	var_dump($input); // could also be print_r
	echo "</pre>";
}

$melons = array('watermelon', 'cantaloupe', 'honeydew');

echo print_r($melons);
echo print_pre($melons);

?>

以上是关于php PHP片段的主要内容,如果未能解决你的问题,请参考以下文章

php PHP:PDO片段

php PHP片段

php PHP片段

php PHP片段

php PHP片段

php Breadcrumbs片段php