# variable declaration

- Thread: https://externals.io/message/26016
- Original archive: https://news-web.php.net/php.internals/26016
- Started by Alain Williams on 2006-10-10T18:52:25+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #26016 — Alain Williams — 2006-10-10T18:52:25+00:00

URL: https://externals.io/message/26016#26016

Hi,

just trying to canvass support for the ability to enforce declaration of variables as with perl's use strict:

	http://bugs.php.net/bug.php?id=39091

-- 
Alain Williams
Parliament Hill Computers Ltd.
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/

#include <std_disclaimer.h

---

## #26017 — Ilia Alshanetsky — 2006-10-10T18:59:45+00:00

URL: https://externals.io/message/26016#26017 · In reply to: #26016

If you want to emulate perl's "strict" mode just add an error_handler 
() that will catch `E_NOTICE` relating to undefined variable, constant,  
array key usage and convert them to fatal errors.




> Hi,
>
> just trying to canvass support for the ability to enforce  
> declaration of variables as with perl's use strict:
>
> 	http://bugs.php.net/bug.php?id=39091

Ilia Alshanetsky

---

## #26018 — Alain Williams — 2006-10-10T19:51:01+00:00

URL: https://externals.io/message/26016#26018 · In reply to: #26017

> If you want to emulate perl's "strict" mode just add an error_handler 
> () that will catch `E_NOTICE` relating to undefined variable, constant,  
> array key usage and convert them to fatal errors.

No, it doesn't do the same thing, it won't pick up the following:

	$fo0 = 'bill';
	...
	$foo = 'ben';

One is a typeo.

> 
> > […]

-- 
Alain Williams
Parliament Hill Computers Ltd.
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/

#include <std_disclaimer.h

---

## #26020 — Ilia Alshanetsky — 2006-10-10T20:08:03+00:00

URL: https://externals.io/message/26016#26020 · In reply to: #26018

> 
> > […]
>
> No, it doesn't do the same thing, it won't pick up the following:
>
> 	$fo0 = 'bill';
> 	...
> 	$foo = 'ben';

Both of these represent valid syntax as far as I am concerned and  
should not generate errors.


Ilia Alshanetsky
