What is going on in this statement?
$this->load->view("index.php");
I've seen this syntax in CodeIgniter and elsewhere where the code is inside a class, hence "$this", and it is referencing "load" or some other method which is then pointing to a method/function it looks like.
Can someone explain to me what "load" is in this? Not in the CodeIgniter context but general PHP. How would i write a class that allows for this?
I tried the following but it doesn't work.
<?php
class myObject {
private $x = 0;
function amethod()
{
function embeddedFunc()
{
$this->x += 7;
return $this->x;
}
return embeddedFunc();
}
}
$object = new myObject();
echo $object->amethod->embeddedFunc();
?>
I'm trying to wrap my head around what's actually happening when i see this.
view().