PHP - my first steps


Yay, I've started some reading in that gigantic - and scary - PHP and MySQL webdevelopment book, and managed to pass data from a form to PHP variables and display them.

While I never was any good at programming - I used to take courses in C++ and Cobol in school - PHP is more geared towards where I spend 95% of my time : online and on the web.

One thing ain't clear though :

&variable only works when register_globals is turned on in php.ini
$_POST['variable'] only works for versions after PHP 4.1.0
$HTTP_POST_VARS['variable'] is guaranteed to work on every server at present time, though is being depreciated, thus could result in broken code in the future.

Starting from PHP 4.2.0, the default setting for register_globals is off, so unless the server admin turns it on in the php config file, using &variable won't work. In some examples I've noticed that they perform a litte trick to copy the content of $HTTP_POST_VARS['variable'] to &variable, but I don't see the benefits. Especially not when both types are relying on uncertain conditions (the first one being depreciated and the latter requiring a setting that's off by default).

Why not immediately go for a use of $_POST, $_GET or $_REQUEST instead and make the minimum requirement PHP 4.1.0? The current version is 4.3.3, so that should be possible, and keep code usable in future versions as well.


He's back, from a galaxy far away....

Joew mate, you're getting into deep! Ok Variable declaration is important and good to know how you have to do it. Got allready a project in mind ? There is this Bossanavo women who needs someone for a PHP - MYSQL project LOL

Ah, so that's what she was referring to :)

Monthly Archives


OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.04

About this Entry

This page contains a single entry by ServMe published on December 25, 2003 6:57 PM.

A feeble attempt was the previous entry in this blog.

Life on Mars? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.