Date
Jul. 14th, 2024
 
2024年 6月 9日

Post: PHP Primer 012 : 常量取值

PHP Primer 012 : 常量取值

Published 12:01 Jan 22, 2012.

Created by @ezra. Categorized in #Programming, and tagged as #PHP.

Source format: Markdown

Table of Content

定义了常量,还要获取常量的值,除了通过我们指定的常量名直接获取外,还可以通过 constant() 函数来获取:

<?php 
    define("PI1",3.141592653);
    define("PI2",3.142);
    $p = "PI2";
    $var_pi1 = PI1;
    echo $var_pi1;
    echo "\n";
    $var_pi2 = constant($p);
    echo $var_pi2;
?>
Pinned Message
HOTODOGO
I'm looking for a SOFTWARE PROJECT DIRECTOR / SOFTWARE R&D DIRECTOR position in a fresh and dynamic company. I would like to gain the right experience and extend my skills while working in great teams and big projects.
Feel free to contact me.
For more information, please view online résumé or download PDF
本人正在寻求任职 软件项目经理 / 软件技术经理 岗位的机会, 希望加⼊某个新鲜⽽充满活⼒的公司。
如有意向请随时 与我联系
更多信息请 查阅在线简历下载 PDF