Coming from an objectpascal background with strict type checking, I am
being driven nuts by PHP.
Stuff like using variables without declaring them, case sensitivity of
variables, getting true, false, 0, 1, "" mixed up, missing the $ before
variables etc is really slowing me down.
Is there a way to configure a run-time setting or interpreter setting
that will throw up warnings or declare an error if some of these issues
are present?
I really need an external lint type program or a run-time setting that
will highlight these issues in PHP.
/My 5 2161 my********@yahoo.co.uk wrote: Coming from an objectpascal background with strict type checking, I am being driven nuts by PHP.
Stuff like using variables without declaring them, case sensitivity of variables, getting true, false, 0, 1, "" mixed up, missing the $ before variables etc is really slowing me down.
Is there a way to configure a run-time setting or interpreter setting that will throw up warnings or declare an error if some of these issues are present?
I really need an external lint type program or a run-time setting that will highlight these issues in PHP.
Use === for a strict type checked comparison, and error_reporting(15) to
get the other stuff (or change the setting in your local php.ini or
httpd.conf files).
--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com my********@yahoo.co.uk wrote: Stuff like using variables without declaring them, case sensitivity of variables, getting true, false, 0, 1, "" mixed up, missing the $ before variables etc is really slowing me down.
Is there a way to configure a run-time setting or interpreter setting that will throw up warnings or declare an error if some of these issues are present?
I really need an external lint type program or a run-time setting that will highlight these issues in PHP.
uninitialized variables will produce a 'NOTICE' exception. Solution would be
to specif error reporting (only) at the start of each script. Set to E_ALL
for testing, something less sensitive for production. Or write your own
error handler.
C.
Are there any examples of the above techniques?
At the beginning of your code, do this:
error_reporting(E_ALL);
when you check if a variable is false, rather than empty, to this:
if (flag === false)
if you want to check if something is storing an integer, you can do
type checking with:
is_integer(i) or is_int(i)
for the $ - your editor should help you identify these. I would
recommend PHP Eclipse.
talking about $, I missed it in all my examples, grrrr
flag should be $flag and i should be $i - sorry about that ... been
programming too much in other languages lately. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Aaron Watters |
last post by:
I'm doing a heart/lung bypass procedure on a largish Python
program at the moment and it prompted the thought that the
methodology I'm using would be absolutely impossible with a
more "type safe"...
|
by: Roman Mashak |
last post by:
Hello, All!
I'm trying to set up macro:
....
int main(int argc, char *argv, char *envp)
{
....
if ( argc > 1 ) {
if ( strcmp(argv, "-d") == 0 ) {
|
by: Sam Sungshik Kong |
last post by:
Hello!
I studied C# a little bit and am trying to compare it with VB.Net.
There's 'Option Strict' in VB.Net.
I thought that if I turn it on, it is as strict as C# when checking types.
See...
|
by: junlia |
last post by:
Hi All,
I am working on a project that acts as a bridge. It does some checking with
post xml data, and then redirects the request to an appropriate page.
However, we find that depends on the...
|
by: Jazz |
last post by:
Hello,
I am using VSNet 2003 and I am trying to programmatically detect if debug
attribute in the compilation tag is true or false. How can I do this ?
Thanks,
Jazz
|
by: Justin |
last post by:
I have set Option Strict On
I also have Enum AssemblyLineStatus As Integer
My question is how come there is no compilation error when I compile
following code?
If...
|
by: Jerad Rose |
last post by:
I believe this issue is specific to ASP.NET. Why does VB.NET (2.0) ignore
the project-level setting for Option Strict?
I have the setting turned on in web.config:
<compilation debug="true"...
|
by: ac.c.2k7 |
last post by:
Hi All,
While doing the cross compilation of pkg_config for directFB for MIPS
target from i86 platform, i am getting the following error.
"checking for extra flags to get ANSI library...
|
by: Squat'n Dive |
last post by:
Does anyone have an idea why -fno-strict-aliasing is turned off when
cross compiling?
in configure generated for 2.4.4:
case $GCC in
yes)
# Python violates C99 rules, by casting between...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |