PHP基础语法-Part2

if-else语句、switch语句

与其他语言相同

循环结构

  • for循环
  • while循环
  • do-while循环
  • foreach循环,搭配数组使用
php 复制代码
foreach ($age as $avlue)      //只输出值
{
	xxx;
}
foreach ($age as $key => $avlue)          //键和值都输出
{
	xxx;
}
php 复制代码
foreach ($age as $key => $avlue)           //多维数组遍历
{
	xxx;
	foreach ($age as $key2 => $avlue2)
	{
		xxx;
	}
}
相关推荐
Empty_7771 小时前
编程之python基础
开发语言·python
疯狂吧小飞牛1 小时前
Lua 中的 __index、__newindex、rawget 与 rawset 介绍
开发语言·junit·lua
寻星探路3 小时前
Java EE初阶启程记13---JUC(java.util.concurrent) 的常见类
java·开发语言·java-ee
哲Zheᗜe༘4 小时前
了解学习Python编程之python基础
开发语言·python·学习
落日漫游4 小时前
数据结构笔试核心考点
java·开发语言·算法
寻找华年的锦瑟5 小时前
Qt-配置文件(INI/JSON/XML)
开发语言·qt
HY小海5 小时前
【C++】AVL树实现
开发语言·数据结构·c++
workflower5 小时前
Fundamentals of Architectural Styles and patterns
开发语言·算法·django·bug·结对编程
Roc-xb5 小时前
ModuleNotFoundError: No module named ‘conda_token‘
开发语言·python·conda
人工干智能6 小时前
Python 开发中:`.ipynb`(Jupyter Notebook 文件)和 `.py`(Python 脚本文件)
开发语言·python·jupyter