TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-27-2009, 08:18 PM   #1 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Smile Everything for a reason...

An entire forum for one of our newest members! How lucky!
http://www.talkphp.com/search.php?do=finduser&u=3595
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.

Last edited by Wildhoney : 06-27-2009 at 11:55 PM.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-27-2009, 08:20 PM   #2 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

hehe, that's interesting, but why not making it a broad section, like " From XX language to PHP Translation?
tony is offline  
Reply With Quote
Old 06-27-2009, 08:20 PM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

'Cause it is not a permanent fixture British sarcasm at its finest!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-27-2009, 08:24 PM   #4 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

haha oh ok :P
tony is offline  
Reply With Quote
Old 06-27-2009, 08:37 PM   #5 (permalink)
The Contributor
 
Normo's Avatar
 
Join Date: Oct 2008
Location: UK
Posts: 30
Thanks: 0
Normo is on a distinguished road
Default

well thats just brilliant...
Normo is offline  
Reply With Quote
Old 06-27-2009, 10:21 PM   #6 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

I lol'd (don't worry, I cleaned it up!)
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 06-27-2009, 10:54 PM   #7 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Very nice.
__________________

Village Idiot is offline  
Reply With Quote
Old 06-28-2009, 12:12 AM   #8 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

Epic .:hehe:.
codefreek is offline  
Reply With Quote
Old 06-28-2009, 10:07 AM   #9 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

I have this Python script, make it PHP!

Python Code:
class Hello:
  @staticmethod
  def world():
    print "Hello World!"

Hello.world()
Salathe is offline  
Reply With Quote
Old 06-28-2009, 11:55 AM   #10 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
I have this Python script, make it PHP!

Python Code:
class Hello:
  @staticmethod
  def world():
    print "Hello World!"

Hello.world()
PHP Code:
<?php
namespace Hello
{
    class World
    {
        public function __invoke()
        {
            echo('Hello World!');
        }
    }
}

$welcome = new Hello\World;
$welcome();

done with our beloved namespace separator! :)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 06-28-2009, 04:56 PM   #11 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

Actually this would make more sense:

PHP Code:
class Hello
{
    static function 
world()
    {
        echo 
'Hello World!';
    }
}

Hello::world(); 
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Old 06-29-2009, 07:30 AM   #12 (permalink)
The Acquainted
 
Join Date: Oct 2007
Posts: 170
Thanks: 18
maZtah is an unknown quantity at this point
Default

Great forum! :)
maZtah is offline  
Reply With Quote
Old 06-29-2009, 08:21 AM   #13 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

ETbyrne is right, but Kalle's code looks more impressive :P
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 06-29-2009, 08:51 AM   #14 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Wrong! The correct translation is of course:
PHP Code:
<?php

define
('Hello''Hello World!');
function 
world(){ echo Hello; }

Hello.world();

?>
Salathe is offline  
Reply With Quote
Old 06-29-2009, 01:03 PM   #15 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

That's nothing like the Python code at all. Pretty cool trick though!
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Old 06-29-2009, 01:29 PM   #16 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
Wrong! The correct translation is of course:
PHP Code:
<?php

define
('Hello''Hello World!');
function 
world(){ echo Hello; }

Hello.world();

?>
Trust Salathe to come up with something crazy!
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 06-29-2009, 01:57 PM   #17 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by ETbyrne View Post
That's nothing like the Python code at all. Pretty cool trick though!
I guess the sarcasm was lost on you. Please don't take anything in this thread/sub-forum as serious (Except this reply?)

Quote:
Originally Posted by sketchMedia View Post
Trust Salathe to come up with something crazy!
I was going to go with const Hello = … instead of the define('Hello'… which would work (as of PHP 5.3) thanks to the namespace support but figured that it would be a little too crazy for today.
Salathe is offline  
Reply With Quote
Old 06-29-2009, 02:06 PM   #18 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

Salathe, that snippet blows my mind. how does it work? is if using concatenation? WOW :O
tony is offline  
Reply With Quote
Old 06-29-2009, 02:07 PM   #19 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
but figured that it would be a little too crazy for today
haha, indeed it would, I've not had my lunchtime coffee yet!

To be REALLY sarcastic you really should post it without wrapping it in PHP code tags, with some strange indentation to boot!
define('Hello', 'Hello World!');
function world() {
echo Hello;
}Hello.world();

But that would be too cruel!
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 06-29-2009 at 02:09 PM. Reason: damn this RTE for stipping out my wierd indents! now i just look a fool!
sketchMedia is offline  
Reply With Quote
Old 06-29-2009, 02:55 PM   #20 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Haha. You're cruel, you're cruel. But I like it very much !
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Clean Code Village Idiot Tips & Tricks 10 06-25-2012 12:35 PM
For some reason when I downloaded the php manual Nor General 5 01-24-2008 02:52 PM
The reason for PHP's lack of protocol Wildhoney General 3 10-03-2007 11:21 AM


All times are GMT. The time now is 10:10 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design