PHP中的IF也可以这样用啊

WBOY
Release: 2016-06-23 14:12:40
Original
945 people have browsed it

if(条件): do someting ;


不加:可以么 


回复讨论(解决方案)

if(条件) do someting;

加了反而是错的

http://www.php.net/manual/en/control-structures.alternative-syntax.php

你那里看到的 好要加:?

什么书啊 真是误人子弟

伪代码?

是不是某种框架里的写法?哈哈哈

if(condition):....end if;
Copy after login
Copy after login
Copy after login
Copy after login

可以这样写

if(condition):....end if;
Copy after login
Copy after login
Copy after login
Copy after login

可以这样写
是这样
if(condition):...endif;
Copy after login
Copy after login
Copy after login


if(condition):....end if;
Copy after login
Copy after login
Copy after login
Copy after login

可以这样写
是这样
if(condition):...endif;
Copy after login
Copy after login
Copy after login

手滑了...

飞过~~~~


if(condition):....end if;
Copy after login
Copy after login
Copy after login
Copy after login

可以这样写
是这样
if(condition):...endif;
Copy after login
Copy after login
Copy after login
替代语法,手册中有提到的

嗯 替代语法

if(condition):
  dosomething;
endif;

while(conditon):
  dosomething;
endwhile;

...........

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!