Answers for "this and self in php"

PHP
3

php self

<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
Posted by: Guest on November-08-2020
0

When to use self over $this

class X {
    private $non_static_member = 1;
    private static $static_member = 2;

    function __construct() {
        echo $this->non_static_member . ' '
           . self::$static_member;
    }
}

new X();
Posted by: Guest on May-18-2020

Browse Popular Code Answers by Language