Php-function-property-exists

提供:Dev Guides
2020年6月23日 (火) 02:46時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

PHP-関数property_exists()

構文

property_exists ( $object, $property );

定義と使い方

この関数は、指定されたプロパティが指定されたクラスに存在するかどうか(および現在のスコープからアクセスできるかどうか)をチェックします。

パラメーター

Sr.No Parameter & Description
1

object(Required)

こんにちはオブジェクト

2

property(Required)

プロパティの名前。

戻り値

プロパティが存在する場合はTRUE、存在しない場合はFALSE、エラーの場合はNULLを返します。

以下は、この機能の使用法です-

<?php
   class hello {
      public $property;
      public f1() { echo($property); }
   }
   property_exists('hello', 'property');
   property_exists('hello', 'Property');
?>