Blogger Information
Blog 5
fans 0
comment 0
visits 5485
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
01--php中的变量应该定义在哪?
小邓的博客
Original
1348 people have browsed it

<?php

// 定义变量
$girl = '小龙女';
$_name = '阿朱'; // 正确
//$123abc = 100;

// 变量必须用$开始,后面必须紧跟着字幕或下划线

$brand;
$brand = null;
// 上面的这两种方式等价

echo $girl;
echo '<hr />';

function cooking($foods) {
   return '杨过正在一口口为小龙女吃:'.$foods;
}
echo cooking('野兔');

function cooking2($foods='野菜')
{
   return '杨过正在一口口为小龙女吃:'.$foods;
}
echo '<hr />';
echo cooking2();

echo '<hr />';
$foods = '野狗';
echo cooking2($foods);



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post