Code just for the helluvit
Results 1 to 10 of 10

Thread: Code just for the helluvit

  1. #1
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,941

    Code just for the helluvit

    Silliness that passed the last quarter hour of work today:
    PHP Code:
    <?php
    class foo {
        public function 
    foo(&$foo) {
            
    $foo create_function(
                
    '$foo',
                
    'echo "Hello, $foo.";'
            
    );
        }
    }
    new 
    foo($foo);
    $foo('foo');
    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  2. #2
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,941
    version 1.1:
    PHP Code:
    <?php
    class foo {
        private function 
    __construct() {}
        public static function 
    foo(&$foo) {
            
    $foo create_function('$foo','echo "Hello, $foo.";');
        }
    }
    foo::foo($foo);$foo('foo');
    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  3. #3
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    PHP Code:
    <?php #> 5.4
    class foo{
        static function 
    newFooClosure $foo ){
            
    $foo $foo->bindTonull,__CLASS__ );
            return 
    $foo;
        }
        static function 
    parentFoo(){
            return 
    get_called_class();
        }
    }
    $foo foo::newFoo( function( $foo ){ echo "Hello, $foo!  My name is ".static::parentFoo(); } );
    $foo'Foo' );
    edit
    or...
    PHP Code:
    <?php #> 5.4
    class foo{
        static function 
    newFooClosure $foo ){
            
    $foo $foo->bindTonull,__CLASS__ );
            return 
    $foo;
        }
        static function 
    parentFoo(){
            return 
    get_called_class();
        }
    }
    $foo foo::newFoo( function()use( &$bar ){ echo "Hello, $bar!  My name is ".static::parentFoo(); } );
    $bar 'Me';
    $foo();
    $bar 'You';
    $foo();
    Last edited by traq; 05-13-2013 at 09:54 PM.

  4. #4
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,941
    And for another layer of absurdity:

    /foo:
    PHP Code:
     <?php
    class foo {
        private function 
    __construct() {}
        public static function 
    foo(&$foo) {
            
    $foo create_function('$foo','echo "Hello, $foo.";');
        }
    }
    /foo.php:
    PHP Code:
    require 'foo';foo::foo($foo);$foo('foo'); 
    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  5. #5
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    Quote Originally Posted by NogDog View Post
    And for another layer of absurdity
    you mean, abstraction.


  6. #6
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,941
    Quote Originally Posted by traq View Post
    you mean, abstraction.

    Yeah, that's it: I knew it started with "abs...".
    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  7. #7
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,563
    You people have foo much time on your hands...
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  8. #8
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,715
    Quote Originally Posted by laserlight View Post
    You people have foo much time on your hands...
    Heh heh ... where's the "like" button?
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  9. #9
    Senior Member
    Join Date
    Mar 2009
    Posts
    809
    Quote Originally Posted by laserlight View Post
    You people have foo much time on your hands...
    They should be barred!
    Declare variables, not war.

  10. #10
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,715
    Quote Originally Posted by Bonesnap View Post
    They should be barred!
    That's a really baz idea if you ask me!
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •