131-Character PHP framework

Source: Internet
Author: User
Tags new features php code php framework require

See this link on the friendfeed--the 140 Characters Webapp challenge!, this competition requires 140 characters of code to create a Web application.

There are 36 programs available for voting, basically all scripting language hodgepodge: Php,perl,ruby,javascript. Implementation is also a variety of applications, there are albums, class Twitter, small games, and even PHP code framework? Excerpts are as follows:

Require __dir__. ' /c.php ';

if (!is_callable ($c = @$_get[' C ']?: function () {echo ' woah! ';})

throw new Exception (' Error ');

$c ();

This code leverages some of the new features of php5.3:

__dir__

Anonymous functions

?: operator

Code is only 131 characters, because the code is extremely simple, security is not guaranteed, can only be counted as a unified access to the program.

If you write this code in PHP 5.2来, it's probably:

Require DirName (__file__). ' /c.php ';

if (!is_callable ($c = @$_get[' C ']? $_get[' C ']: Create_function ("," Echo ' woah! '; ")))

throw new Exception (' Error ');

$c ();

If you want to make this code practical, you can add a prefix to the $c so that the security is further enhanced and the code will add several bytes accordingly.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.