Click to See Complete Forum and Search --> : Is it possible to send a break() to a class function?


Kyleva2204
08-28-2008, 06:15 PM
Hello all, I would like to know if this would be at all possible..

It would be easier to just show how I would think it would be done:

class my_class{
function my_class(){
$this->kill_all();
echo 'This should not be displaying..';
}

function kill_all(){
$this->my_class()->break();
}
}


would this idea be possible? If so, how?

Kyleva2204
08-28-2008, 07:01 PM
Sorry, i wasn't paying a bit of attention, I know its actually break; and not break(). heh

NogDog
08-29-2008, 12:18 AM
For your consideration:

<?php

class Test
{
public function hello($die = false)
{
if($die)
{
unset($this);
}
else
{
echo "<p>Hello, World.</p>\n";
}
}
public function __destruct()
{
echo "<p>Goodbye, World.</p>\n";
}
}

$test = new Test();
$test->hello();
$test->hello(true);

Kyleva2204
09-04-2008, 11:53 PM
Ha probably should of read the documentation for that one. Thanks :)