Ranthologia: Rants on the Big Web 2.0

work, freelance and web development…and a bit of life.

PHP short tags: sticking to the standards

with one comment

A word about standards

Each time the latest PHP build comes out, the older features get phased out in the long run. The famous of these would be the ‘register_globals’ settings in the php configuration file. By default, this variable is conveniently set to ‘On’ so users (mostly newbies) won’t have to tinker with the advanced settings and messing everything up. Although convenient, developers were advised to use the global arrays method of accessing PHP variables being passed across scripts:


// older version, with register_globals turned on
$username = $form_username;


// latest PHP builds. register_globals is alreay OFF by default
$username = $_POST['form_username']; // for POST arrays
$username = $_GET['form_username']; // for GET arrays

Most developers tend to be too lax about implementing the newest method of calling variables, always sticking to the older style. As a result, some applications end up having obsolete code. PHP5 already has this option turned off for security reasons.

PHP short tags obsolete
The ASP style closing tags (”) and short-tags (”) have been abandoned and replaced by the latest PHP-style tags (” ). Developers will need to stick to the new coding style in order for it to work on the latest build of the PHP interpreter:
code_preview.jpg

Written by Mike Suria

September 6, 2007 at 2:47 pm

One Response

Subscribe to comments with RSS.

  1. You are retarded if you think short tags have been phased out or will ever be phased out. Do some reading on the subject so you dont spread misinformation.

    ha

    August 18, 2008 at 9:22 pm


Leave a Reply