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;
	}
}
相关推荐
JaguarJack1 天前
推荐 PHP 属性(Attributes) 简洁读取 API 扩展包
后端·php·服务端
BingoGo1 天前
推荐 PHP 属性(Attributes) 简洁读取 API 扩展包
php
JaguarJack2 天前
告别 Laravel 缓慢的 Blade!Livewire Blaze 来了,为你的 Laravel 性能提速
后端·php·laravel
郑州光合科技余经理3 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1233 天前
matlab画图工具
开发语言·matlab
dustcell.3 天前
haproxy七层代理
java·开发语言·前端
norlan_jame3 天前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone3 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
QQ4022054963 天前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
QQ5110082853 天前
python+springboot+django/flask的校园资料分享系统
spring boot·python·django·flask·node.js·php