Blogger Information
Blog 29
fans 1
comment 1
visits 24703
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php基础变量,全局变量,作用域,静态变量 2018-4-13
谦谦允水的博客
Original
757 people have browsed it

实例

<?php 
	$aa=new stdClass();
	$aa->name = 'pengli';
	echo "<pre>";
	print_r($aa);
	var_dump($aa);
	echo "<hr>";
	$output='输出函数:(echo  print)输出单一变量  (print_r var_dump)输出数组,对象';
	echo $output.'<hr>';
	$arr='数组创建:$a=[];  对象创建:$b=new stdClass()';
	echo $arr.'<hr>';
	$type='变量类型查看:gettype(变量)';
	$a='';
	$b;
	$c=0;
	$d=null;
	$e=[];
	$f=new stdClass();
	echo gettype($a).'<hr>';
	echo gettype($b).'<hr>';
	echo gettype($c).'<hr>';
	echo gettype($d).'<hr>';
	echo gettype($e).'<hr>';
	echo gettype($f).'<hr>';
	echo $type.'<hr>';
	$typechange='类型转换(int) (string) intval($) stringval($) 永久转换:settype(改变原来类型)';
	echo $typechange.'<hr>';
    $detection='变量类型检测:返回的是布尔类型 is_integer() is_integer() is_string() is_null() is_numeric(0)  unset($)销毁变量 isset(是否初始化变量) empty(是否为空 0  null 都为空)';
 	echo $detection.'<hr>'; 
 	$g='全局变量:GLOBALS[name]';
 	echo $g.'<hr>';
 	?>  
 <!DOCTYPE html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8">
 	<title>Document</title>
 </head>
 <body>
 	
 </body>
 <script>
 	var a={age:20};
 	a.name="pengli";
 	console.log(a);

 </script>
 </html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


1523550623866.jpg

1523550639475.jpg

1523550656578.jpg

Correction status:qualified

Teacher's comments:
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