property_existsとは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > property_existsの意味・解説 

property_exists

(PHP 5 >= 5.1.0)
property_exists — オブジェクトもしくはクラスにプロパティが存在するかどうかを調べる

説明

bool property_exists ( mixed class, string property )
この関数は、与えられたプロパティ property が 指定されたクラスに存在するかどうか (かつ現在のスコープからアクセス可能かどうか) を確認します。
注意: isset() とは対象的に、 プロパティの値が NULL の場合でも property_exists()TRUE を返します。

パラメータ

class
確認するクラス名、もしくはクラスのオブジェクトを指定します。
property
プロパティ名を指定します。

返り値

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

例 362. property_exists() の例
<?php

class myClass {
   public $mine;
   private $xpto;

   static function test() {
       var_dump(property_exists('myClass', 'xpto')); // ここからアクセス可能なので true
   }
}

var_dump(property_exists('myClass', 'mine'));  //true
var_dump(property_exists(new myClass, 'mine')); //true
var_dump(property_exists('myClass', 'xpto'));  //public でないので false
myClass::test();

?>


参考

method_exists()



このページでは「PHP関数リファレンス」からproperty_existsを検索した結果を表示しています。
Weblioに収録されているすべての辞書からproperty_existsを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からproperty_exists を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「property_exists」の関連用語

property_existsのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



property_existsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2025 by the PHP Documentation Group.

©2025 GRAS Group, Inc.RSS