![]() |
if condition clause
i found this thru my error checking on a script.
PHP Code:
It is flagged now because it is not $condition . I did a search of the script with ransack and could not find anything that was labeled as a function or $value by the same name. So is this a proper call? here is that section of file.. PHP Code:
|
It must be a defined constant somewhere. That or its a PHP magic variable like __LINE__ and __FILE__. I've never seen it myself though but that doesn't mean it doesn't exist.
|
All magic in PHP starts with __. Lets see if I can find a link for that. Ah, here it is: http://www.php.net/manual/en/userlandnaming.rules.php
condition is not a valid pre-defined constant. Either it was set as constant prior within script, or you simply did not have your error reporting set highly enough. If condition is not declared, it will trigger E_NOTICE and return true, since the string 'condition' is true. So if its not a valid defined constant, than you've been returning true regardless of if it should have been or not. |
Thank you both, yep i guess thats what it was never flagged because it was true. This page was actually done by someone else that i let help me on this project awhile back and sadly i was unable to get ahold of him.
I will probably just remove it. As i have done a search for condition, $condition, condition ( <-- in case it is a function, and function condition, *condition* , and nothing has been found. So i will just remove it. Thanks to you both.. :) |
Quote:
Never thought about mentioning error reporting.. I assumed DG would have that turned on anyway after hanging around here and seeing it mentioned plenty of times.. my bad lol :o |
Yes Sir i did have errors on, thats how i found it :)... i must be learning lol... And fyi i did remove it and it seems to be working fine. I know that at one time we had talked about placing a new condition for approval and that must have been when that was placed in there and it was just left by mistake from development. Back then i was not so savy to catch things and trusted more than i should and did not oversee things so much.
But now that i am doing everything myself i am very very picky and i try not to leave much to chance. :) |
Yeppers, what I mean though is that your old configuration would also have the same errors, but the reporting wasn't set to include E_NOTICE.
I'm not sure what's sadder actually, the amount of what I know when I look through the manual, or what it is I *don't* have memorized O.o. There's just so much to this language. |
There has to be a point (a plateau) where you know so much about the language that even if you dont read the manual i would think the answer has to be logical or should be. When you get to the point that you have to plug your ears so it dont leak out its time to slow down a bit i would think...
|
Quote:
PHP is a doddle IMO. Sure, takes a while to get the grip of the basics and the difference between a web language and a windows language but by comparison there is a lot less to worry about I'd say. The beauty with php is that if you want to do something and don't know how, it's usually a case of hitting google, grabbing someone elses code, modifying it to your needs and then debugging until its perfect. In windows languages it doesn't always work out like that.. you can be missing a dependant component for a start, have the wrong IDE for a component set... ah it's a nightmare. Object Pascal (Lazarus / Delphi).. now there is a swine to tame. The amount of hassle I've had with that language and components for this and that.. the IDE alone is a monster. I really should try and switch to something else but I have a few too many projects that need to be finished first :o |
Never dealt with Pascal but i have been introduced way back when in college to Assembly and that was more than enough for me to say no thanks to that.
And i totally agree with you on the windows deal. Even at the VPS hosting level apache/linux side is soooo much easier. Sure both sides have tons of options but OMG i just had to set up a VPS on Windows and it was a royal pain. But i guess everything is easy once you know how and work with it. Im sure even the elite Pascal coders might think what they do is easy, its all relative i suppose. |
Well thats just it, compared to some other languages I would say that Pascal is probably easier than others where you have to start from the ground up (which as far as I understand is what you do with c, c++). Fou knows about all those 'other' languages so he will be better to comment. With Object Pascal you get an IDE, form designer, events handlers etc.. in theory its a doddle.. at least until you end up dealing with the OS and different threads etc and then it can get out of hand very quickly and you really have to be thoughtful about how you design the program. When you've used a language like that, PHP becomes a lot easier to use as you don't have a lot of that to worry about, it's just a flow of logic and nothing else really.
Assembly.. thats somewhat of a murky beast. Even in windows 3rd level languages you're often expected to understand hex (which the windows calc can translate) and assembly instructions. The problem with assembly is that in a windows program it can literally be several thousand lines of code just to do the basics. I've tried debugging code in the delphi ide by following the assembly instructions and you end up jumping around all over the place for thousands of lines before you see anything you would remotely recognise as familiar code. IMO assembly is better suited to hardware devices such as PIC processors made by microchip and other things like the Atmel range (used for arduino boards) but even arduino uses a c++ compiler (I think its ++) so that you can write 3rd level code and compile it down before uploading to the board. I have another device (an electronics learning board thing) which has a basic chip with just 15 instructions.. it accepts input states as hex numbers and output states as hex numbers.. but actually trying to compare the state of each pin is a real head scratcher. I wrote a basic burglar alarm on it once, it could save the initial state of all the pins but then trying to loop through and compare each pin to its original state using hex numbers... urrrrrgggh NO! With assembly the hardest thing to understand is registers and all that cr*p. There really is no need for the complex wording they use to describe it all either. There are other languages that are even worse too.. I remember one years ago that used symbols on graphical lines. It was really weird and somewhat of a brain twister. I'd never touch that again.. |
I think you may be mistaken on what I am referring to as the complexity.
PHP has a very large core api, and it is rife with inconsistencies. From the simple such as reversed evaluation on ternary operations, to the complex with inconsistent function names and parameter lists. Tack on an (actually pretty good considering all) OO interface to the procedural language, and that has just doubled the complexity of it all. So with every step in the PHP language, from the primitive to the complex, PHP is one of the most offending languages when it comes to, well, logic. It was designed to be used by those with less programming experience, so the idea is to try and make it easier for starting simple websites. Problem is as developers become better and programming in general, PHP starts becoming quite cumbersome in how it has implemented its functions. This is why I never recommend PHP as a starting language as it is so very. . . unique. |
Got ya Fou-Lu :)
I think i was attracted to php because of my love for COBOL in my college days. |
Quote:
From my POV though, actually using PHP is still a lot less complex than a win32 language where you have so much else to worry about. Have you ever seen the souce code for Indy Sockets? - Ever tried debugging it while you have multiple threads running? It's not nice but you have to have multiple threads to make sure the server will handle everything properly. With PHP you don't get any hassle like that really. While I agree it has a lot of other weird things going on, it's also a charm to use for its simplicity in other things. I'll admit the annoying function names and the parameter lists are a mega pain but then I cheated to solve that - I have a javascript button on my browser tool bar with a prompt - type in the functionname, hit ok and it'll look up the function on php.net OR take me to a search results page which will list anything similar. That lets me get to the parameter list in seconds so from my POV, this is not such a big issue. |
| All times are GMT +1. The time now is 04:42 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.