Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
use strict

Posted by John_Moylan (John_Moylan), 17 July 2002
Well after using PHP for the past month my biggest gripe is the lack of 'use strict'.

This pragma has been a godsend in Perl, surely it's got to come soon to PHP.

Or am I the only one who thinks this?


Posted by admin (Graham Ellis), 18 July 2002
Both Perl and PHP have "grown up" from languages in which programmers wrote relativly short utility scripts into languages in which major applications are written. This forum is a good example - it happens to be written in Perl (yes, I know I'm posting on the PHP board!), but that's not the origins.  Recall that PHP was originally "Personal Home Pages", and Perl is the "Practical Extraction and reporting language".  Neither of these imply big applications.

When writing a shorter piece of code, having to declare variables adds code which isn't really necessary.  It takes time to type in all those "int" or "float", "my" or "our" words and ensure that they're all present, and for what real gain?  As your application gets longer, so variable declaration does have a point - it ensures that you don't have a "typo" somewhere in your code that is hard to find during testing and it helps in the "selfdocumentation" of something that's going to take more reading / understanding than a little utility.

PHP does not (as far as I know) have an equivalent of "use strict".  You can use the error_reporting function to help you catch variables that you have not initialised in your code; see the online manual at

Here's an example of it in use:

// Reporting E_NOTICE to report uninitialized
// variables or catch variable name misspellings ...
error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE);


This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

Comment: "I agree with John. The bulk of time is spent on design and ..."
Visitor Ranking 4.0 (5=excellent, 1=poor)

Comment by Rutishauser (published 2010-07-15)
I agree with John. The bulk of time is spent on design and debugging, rather than on pressing keys on the keyboard. So, no matter what you are writing, a big complicated program or a couple of simple lines, strict typification is certainly of great help. [#3629]

You can Add a comment or ranking or edit your own comments

Average page ranking - 4.0

© WELL HOUSE CONSULTANTS LTD., 2021: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho