Phpframework with 131 characters

Source: Internet
Author: User
On friendfeed, we can see this link & mdash; The140CharactersWebappChallenge !, This competition requires 140 characters of code to create a web application. There are 36 programs available for voting, basically all of which are a collection of scripting languages: php, perl, ruby, ja... "> <LINKhref =

You can see this link on 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 of which are a collection of scripting languages: php, perl, ruby, and javascript. There are also a wide variety of applications, including photo albums, twitter-like games, and even php code frameworks? The excerpt is as follows:

Require _ DIR _. '/c. php ';

If (! Is_callable ($ c =@$ _ GET ['c']? : Function () {echo 'Woah! ';}))

Throw new Exception ('error ');

$ C ();

This code utilizes some new features of php5.3:

_ DIR __

Anonymous functions

? : Operator

The code contains only 131 characters. because the code is very simple and the security is not guaranteed, it can only be regarded as a unified entry for one program.

If you use php 5.2 to write this code, it is 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 more practical, you can add a prefix before $ c, which will further improve the security and add several bytes to the code.

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.