Re: [PHP] $_POST['name'] [HELP]
I'd have to agree with DeathArt here. One of my first real PHP projects was a huge website project for a group of people who could all add posts, make blog entries, upload files, send in pictures for the galary, an entire CMS with admin panel for editting static pages, etc. Took me and another guy a week or two to get it working, but after that we kept improofing and adding functionality for over a year. Total codebase when I stopped working on it was about 8000 lines of code.
After that first year of course there were still some bugs, but since I wrote that initial code quite crappy (I was young and inexperienced like so many new coders :wink:) I could only read it with a lot of effort and modifying it was hell. For some new functionality to work I had to actually rewrite an entire 200 lines long function from scratch.
I also added functionality to code I wrote after working on that site for a year. A database driven search engine class to be precise, where I wanted to add functionality to search trough pictures.
Took me about 10 minutes to write the add-on that could flawlessly be appended to the existing code.
I think you can see where I'm getting at: the better structured and thought-trough you write, the easier it is to change it later on. If you write good code from the start you'll never have to worry about it later.
Another example: what if, somewhere, you write something like this:
PHP Code:
define('superfun', 'A LOT of fun!', true);
Now, without even modifying your original code it will suddenly stop doing what you wanted! You could spend hours trying to troubleshoot a bug like this, and it could have been so easily prevented just by adding a few quotes!
Daevius: as for string concatination: I don't. Ever. If I have a variable inside a textstring I've done something very, very wrong. The way I code is using a template parser and template and config files. I never mix output with PHP code, which, coincidentally, is another one hell of a good code practise :wink:
Re: [PHP] $_POST['name'] [HELP]
Quote:
Originally Posted by
FragFrog
Daevius: as for string concatination: I don't. Ever. If I have a variable inside a textstring I've done something very, very wrong. The way I code is using a
template parser and template and config files. I never mix output with PHP code, which, coincidentally, is another one hell of a good code practise :wink:
Yeah, you recommended that to me once before :), I luv the class :D, I use it for the bigger projects. So in general I barely use concatination for real projects, but I was wondering what would be faster. Because for MySQL query stuff you need to give a string as argument, where you often have to concatinate...
Re: [PHP] $_POST['name'] [HELP]
Well, in that case, it's faster to use 'text'.$variable.'more text'. As stated, 'text $variable text' won't even work and "text $variable text" is slower :smile:
Re: [PHP] $_POST['name'] [HELP]
Re: [PHP] $_POST['name'] [HELP]
Quote:
Originally Posted by
FragFrog
Well, in that case, it's faster to use 'text'.$variable.'more text'. As stated, 'text $variable text' won't even work and "text $variable text" is slower :smile:
Ok, thanks. Than I do it correct ;)
Quote:
Originally Posted by
BullDog15
IDK UNDERSTANd
???
You don't _have_ to understand...