互联网从业者的资讯社区
互联网从业者的资讯社区
下载 App 在 App 中打开
今日热议

好枯燥啊 要命!

<?php
function hr(){
$hr='<hr>';
return $hr;
}
$hr=hr();
$a=$b=10;
echo $a;
echo $b;
echo '<hr>';
$f= 'houdunren';
echo$f;
echo '<hr/>';
$a =1;
$b =&$a;
$b=3;
echo $a;
echo $b;
echo '<hr>';
$name ='word';
$$name= 'houdunren';
echo $name . ',' . $word.','.$$name;
echo '<hr>';
var_dump($_GET);
$name = 'nihao';
print_r($GLOBALS['name']);
echo '<hr>';
$function = 'function';
function show(){
global $function;
echo $function;
print_r($GLOBALS['name']);
}
show();
$switch = 'switch';
echo '<hr>';
echo$switch;
unset($switch);
var_dump(isset($witch));
echo '<hr>';
$whilee= 'while';
function whilee(){
global $whilee;
echo $whilee;
unset($whilee);
var_dump(isset($whilee));
// var_dump($whilee);
echo isset($whilee);
if(isset($whilee)){
echo $whilee;

}else{
echo'已被删除';
}
}
whilee();
echo '<hr>';
function switchh(){
static $switchh= 1;
$switchh = $switchh + 1;
return $switchh . '<hr>';
}
echo switchh();
$switchh=switchh();
// echo $switchh;
echo switchh();
echo switchh();
echo $switchh;
echo $switchh;
echo octdec(777);
echo hr();
echo hexdec('FAF');
echo hr();
// 类型 说明
$integer=1; // integer 整型
$float =0.1;// float 浮点型
$string='string';// string 字符串
$boolean= true ||false||0||''||null||array();// boolean 布尔型
$array=[1,2,'3']||array(1,2,'3');// array 数组
class Demo{};// object 对象var_dump((new Demo));
var_dump((new Demo));
$boolean= true ||false;// 布尔值 FALSE
// 整型值 0(零)
// 浮点型值 0.0(零)
// 空白字符串
// 字符串 "0"
// 没有成员变量的数组
// 没有单元的对象(仅适用于 PHP 4)
// 特殊类型 NULL(包括尚未设定的变量)
echo $hr;
$string ='$string__';
echo $string;
header('Content-type:text/html;charset=utf-8');
echo "双引号里可以写变量{} {\$string},$string";
echo $hr;
echo $string = "这是双引号特定的符号需要反斜杠来转义q\nn\twer";
echo $hr;
$str =<<<str
定界符里面可以装什么呢?
$string,\\\\""‘’''{}\\\$ swigch while
echo hr();
str;
echo $str;
echo hr();
$string = 'sring sring sring sring,string ';
$strhz= '中国字就是大啊';
echo strlen($strhz);
echo hr();
echo mb_strlen($string,'utf-8');
echo hr();
echo var_dump(strlen($string));
echo hr();
$string = trim($string);
echo strlen($string);
echo hr();
echo strtoupper($string);//转大写
echo hr();
echo ucfirst('hello|world');
echo hr();
echo ucwords($string, ' , ');
$string='while';
echo hr();
echo md5($string).'.php';
echo hr();
$file = 'use-1-info';
echo md5($file).'.php';
echo hr();
$view = '123/234/345.php';
echo md5($view).'.php';
echo hr();
$explode= explode('/',$view);
print_r($explode);
foreach($explode as $k=>$v){
echo$v.'<br>';
}

echo hr();
$ifle=(explode('/',$view));
print_r($ifle);
$implode= implode(':',$ifle);
var_dump($implode);
echo hr();
echo mb_substr($string,0,100);
echo hr();
$substr='你好我的朋友';
echo substr($substr,0,-1);//不支持中文
echo hr();
echo mb_substr($substr,0,2);
define('NAME', [1,2,3],true);
echo var_dump(name);
echo hr();
const URL = 'WWW.LIOOIL.CN';
echo URL;
echo hr();
define('router', 3<2);
var_dump(router);
echo hr();
const NAMES= '后盾人';
function names(){
echo NAMES;
}
names();
echo hr();
var_dump(defined('UR'));
// echo defined('UR');
echo hr();
echo PHP_VERSION;
echo hr();
ECHO PHP_OS;
echo hr();
class Demoo{
public function showw(){
echo __METHOD__;
}
}
(new Demoo())->showw();
echo hr();
var_dump(get_defined_constants(true)['user']);
echo hr();
$var ='123';// '三元运算符';
echo $var?(false?:'nihao'):'knakna';
echo hr();
$vars ;
var_dump(isset($vars));
echo $vars??'no';
echo isset($vars)?'yes':'no';
echo hr();
if($var){
echo $var;
};
echo hr();
if($var):
echo $var;
else:
endif;
echo hr();
$switch = '12345';
$switchh= '123';
switch($switchh){
case '12345':
echo $switch;
break;
case '123':
echo '123';
break;
default:
echo 'kk';
}
echo hr();
$age =20;
switch($age):
case $age < 10:
echo 'xiaohai';
break;
case $age<30:
echo 'qingnian';
break;
default:
echo 'laonian';
endswitch;
echo hr();
while($age>0){
echo ($age--);
}
echo hr();
$age=20;
while($age>0):
echo $age--;
endwhile;
echo hr();
do{
if(!isset($while)):
$while=10;
endif;
echo ($while--);
}while($while>0);
echo hr();

for($for=10;$for >0;$for--){
echo $for;
}
echo hr();
do{
if(!isset($num)){
$num=10;
}
if($num == 0):
break;
endif;
echo $num--;
}while(true);
echo hr();
$num = 0;
while(true):
$num++;
switch($num){
case $num % 2 == 0;
echo $num.',';
break;
case $num % 15 ==0;
echo $num.',';
break 2;
}
endwhile;
echo hr();
for($while=10; $while> 0; $while--){
var_dump($while);
if($while%2==0)continue;
echo$while .',';
}
https://zhijieshequ.com/post/z5LJAmLQ
回复 去玩儿改名

未登录无法操作

评论
列表为空,暂无内容

服务条款 隐私政策 Cookie 使用条款

© 2024 知结社区 | Powered by Fresns

弗雷森斯(苏州)科技有限公司

苏ICP备2021027795号-3

增值电信业务经营许可证:苏B2-20210954

广播电视节目制作经营许可证:(苏)字第02601号

不良信息举报: jubao@fresns.cn