Jump to content

akheron

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

akheron's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi businessman, I don't want to offend you or anything if I'm totally off-base, but I just want to ask. Are you like 13-14 years old or something?
  2. Here is a good one if you really need something professional: [a href=\"http://evoluted.net/archives/2005/08/directory_listi_2.php\" target=\"_blank\"]http://evoluted.net/archives/2005/08/directory_listi_2.php[/a] If you just need a simple directory listing then write it yourself, it's very very easy to implement in PHP, should probably be under 20 lines in total.
  3. Unfortunately what I gave was a very simple example and in the script I'm working on the check to see wether the object can be created is very complex and long, something I would rather not have to include everytime an object is created, furthermore I'd like to do this with a variety of different classes so segregating that check into a global function wouldn't really help me either. Also, you say you can clean up the extra bits by calling the destructor, but this does not clean up the memory, am I right? Previously, in PHP 4, one could unset() an object from within a function of that object, but it doesn't seem to work in PHP 5. I suppose I will implement your suggestion if I can't find any other solution but I'd rather have a cleaner way to do it, thank you for your help though.
  4. Hi, I've been trying to figure out how to make an object abort it's own instantiation, I've searched all over google and php.net to no avail and could really use a hand. What I need is to be able to check to see if certain conditions are met within the constructor function and if they are not then destroy the object and pass that the object could not be created. Here is some sample code showing exactly what I'm trying to do. [code] class myClass {     public function __construct($number)     {         if(!is_int($number)         {             break_fail_commit_suicide_kill_object();         }     } } $val = 'text'; if( $myObject = new myClass($val) ) {    echo "this should not print"; } $val = 5; if( $myOtherObject = new myClass($val) ) {    echo "this should print"; } [/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.