Self Vs This In Php

[Solved] Self Vs This In Php | Php - Code Explorer | yomemimo.com
Question : self vs this in php

Answered by : sila-arasan

<?php
class X { private $non_static_member = 1; private static $static_member = 2; function __construct() { echo $this->non_static_member . ' ' . self::$static_member; }
}
new X();
?>

Source : https://stackoverflow.com/questions/151969/when-should-i-use-self-over-this | Last Update : Sat, 28 May 22

Answers related to self vs this in php

Code Explorer Popular Question For Php