Blogger Information
Blog 21
fans 0
comment 0
visits 19957
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP基本语法
电动机的博客
Original
1000 people have browsed it

总结

变量、常量的区别以及驼峰法命名

注释的三种方法 // # 单行  /* 多行

符号:=、+、-、*、/、%、.、++、--

数据类型:标量(单值)、复合(数组)、特殊(空值)

数组分为:索引数组、关联数组 ;一维数组、多维数组;

PHP循环:for、while、 do while (三个是计数循环)、foreach(数组循环);


实例

?php
  header("Content-type: text/html; charset=utf-8");
  // $a='我是刘';
  // echo $a;
  // <hr>;
  // define('PHP_NAME','php中文网');
  // echo PHP_NAME;
  //  
  // var_dump($a)
  // $arr= array('刘',18,'男','liu' );
  // var_dump($arr);
  // $arr  = array(array(
  // 	     'id' => 1,
  //        'name' =>'刘',  
  //        'age'=>18,     
  //        'py'=>'liuhong'
     
  //      ),array(
  // 	     'id' => 1,
  //        'name' =>'刘2',  
  //        'age'=>18,     
  //        'py'=>'liuhong'
     
  //      ),array(
  // 	     'id' => 1,
  //        'name' =>'刘3',  
  //        'age'=>18,     
  //        'py'=>'liuhong'
     
  //      ));
  //   print_r($arr[0]['name']);
//   $length=count($arr);
// for ($i=0; $i <$length ; $i++) { 
// 	echo $arr[$i].'<hr>';
// // }
//    $i=0;
//   $length=count($arr);
  // while ($i< $length) {
  // 	echo $arr[$i].'<hr>';
  // 	$i++;
  // }
  

  $arr=array(
   array(
   6,
   '欧阳克',
   18,
   '男',
   'ou@php.cn',
   '123456'
       ),
  array(
  7,
  '王蓉',
  15,
  '女',
  'hr@php.cn',
  '123456'
      ));
  $c=count($arr);
   echo  $c;
 		for($i=0; $i<$c; $i++){
 		   
 			echo$arr[$i][0].'<hr>';
 			echo $arr[$i][1].'<hr>';
 			echo $arr[$i][2].'<hr>';
 			echo $arr[$i][3].'<hr>';
 			echo $arr[$i][4].'<hr>';
 			echo $arr[$i][5].'<hr>';
 		   
 	        }
?>

运行实例 »

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

Correction status:Uncorrected

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!