PHP-constant():定数値を返します
PHP関数
constant
サマリ
定数値を返します.
関数プロトタイプ
説明:
PHP 4.0.4から提供されます.
は、ていすうという名前の値を返します.
変数に格納するか、関数によって返されます.
この関数はクラス定数とともに動作します.
定数値を返すか、定数が定義されていない場合は、
定数が定義されていない場合は、
例
https://phpman.ml/constant
https://www.php.net/manual/en/function.constant.php
そうかんかんすう
define
defined
copyright phpman all right reserved
インスタントレコーダ uses phpman 's content under contract.
インスタントレコーダで開発依頼を要求する場合は、FAQを参照してください.適切であれば、[email protected]に連絡してください.
constant
サマリ
定数値を返します.
関数プロトタイプ
constant ( string $name ) : mixed
パラメータ$name
定数名.説明:
PHP 4.0.4から提供されます.
は、ていすうという名前の値を返します.
constant()
は、定数値を検索する必要があるが、名前が分からない場合に便利です.変数に格納するか、関数によって返されます.
この関数はクラス定数とともに動作します.
定数値を返すか、定数が定義されていない場合は、
null
を返します.定数が定義されていない場合は、
E_WARNING
レベルのエラーが発生します.例
define("MAXSIZE", 100);
echo MAXSIZE;
echo constant("MAXSIZE"); // same thing as the previous line
interface bar {
const test = 'foobar!';
}
class foo {
const test = 'foobar!';
}
$const = 'test';
var_dump(constant('bar::'. $const)); // string(7) "foobar!"
var_dump(constant('foo::'. $const)); // string(7) "foobar!"
リファレンスhttps://phpman.ml/constant
https://www.php.net/manual/en/function.constant.php
そうかんかんすう
define
defined
copyright phpman all right reserved
インスタントレコーダ uses phpman 's content under contract.
インスタントレコーダで開発依頼を要求する場合は、FAQを参照してください.適切であれば、[email protected]に連絡してください.
Reference
この問題について(PHP-constant():定数値を返します), 我々は、より多くの情報をここで見つけました https://velog.io/@instantcoderweb/PHP-constant-상수-값을-반환합니다テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol