Android programmers learn PHP development (3) - loop variables are true, false and not empty - PhpStorm

黄舟
Release: 2023-03-06 09:42:01
Original
1007 people have browsed it

Because PHP was produced in 1994, its syntax is a mixture of C, Java, Perl and some of his own programming syntax.
So, students who have basic knowledge of Java before will not have too much trouble learning.

";
    }
    /** 上面的for循环的打印结果,如下:
        iwanghang0
        iwanghang1
        iwanghang2
        iwanghang3
        iwanghang4
        iwanghang5 */

    /**
     * var_dump 打印一个变量的类型和值
     * 看下面3个例子
     */
    var_dump($name); // 打印结果:string(9) "iwanghang"
    echo "
x = ".$x."
"; // 打印结果:x = 6 var_dump($x); // 打印结果:int(6) echo "
"; var_dump(666); // 打印结果:int(666) echo "
"; /** * isset 判断真假 */ $nameInit = isset($name); var_dump($nameInit); // 打印结果:bool(true) echo "
"; $nameInit1 = isset($name1); var_dump($nameInit1); // 打印结果:bool(false) echo "
"; /** * 布尔值(真假)判断 */ if(isset($name)){ echo "真
"; // 打印结果:真 }else{ echo "假
"; } if(isset($name1)){ echo "真
"; }else{ echo "假
"; // 打印结果:假 } /** * 为空判断 */ if(empty($name)){ echo "空
"; }else{ echo "非空
"; // 打印结果:非空 } if(empty($name1)){ echo "空
"; // 打印结果:空 }else{ echo "非空
"; } /** * x等于6 * empty($x)为非空 * var_dump(empty($x))返回布尔值为假 * * x1不存在 * empty($x1)为空 * var_dump(empty($x1))返回布尔值为真 */ echo $x."
"; // 打印结果:6 echo "".empty($x)."
"; // 打印结果: var_dump(empty($x)); // 打印结果:bool(false) echo "
------
"; echo "".empty($x1)."
"; // 打印结果:1 var_dump(empty($x1)); // 打印结果:bool(true)
Copy after login

The above is the content of Android programmers learning PHP development (3) - loop variables are true, false and not empty - PhpStorm. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
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!