PHP $this variable

前端 未结 6 1260
日久生厌
日久生厌 2020-12-29 22:28

I am reading some PHP code that I could not understand:

class foo {
  function select($p1, $dbh=null) {
    if ( is_null($dbh) )
        $dbh = $this->dbh         


        
6条回答
  •  感情败类
    2020-12-29 22:33

    PHP is not strict about requiring class property declarations.

    • Upon assignation, the property is silently created.
    • Reading from a non-existent property generates a Notice if E_STRICT is enabled.
    • The default value for any undefined property is NULL

提交回复
热议问题