Link to home
Create AccountLog in
Avatar of scrathcyboy
scrathcyboyFlag for United States of America

asked on

Hardest PHP programming challenges

What do you think are the hardest PHP programming challenges?  Just list some of the most difficult as you see it.
I had a disagreement with some supposed PHP experts as to what was the hardest things to master in PHP -- what they thought were tough, I thought were simple, and vice versa .....
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

php is a programming language.  That means it is built around sequence, if-then-else, and do-while.  All the rest is syntax -- where to put the commas, semicolons, and brackets.

As such there is nothing difficult about it.  Any difficulty arises from not understanding the structures of programming, not the language.

Therefore, what is difficult for each person will necessarily be dependent on individual differences.  If you don't understand matrices/arrays, then you will find php's arrays very difficult.  If you do, you will find them simple and powerful.

If you don't understand query databases, you will find php's mysql interface difficult.  If you do, you will find them simple and straightforward to use.

I could go on and on.  Whatever you think is the most difficult part of php is merely where you should reinforce your understanding of basic programming.
I think the hardest stuff is the stuff that you have less experience doing.  It's all easy if you have done it before.  What do you think is the hardest?  
Good answer yodercm, you beat me to it
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
GMTA, guys!
Avatar of scrathcyboy


thanks routinet, good ideas, I hoped for a few more specifics from other people.  I find the DB interaction very easy, which is what a lot of people find hard, as an example.  Not sure if it is all just experience, some aspects of PHP are hard for some people.  Sessions for example, have any of you done them?  How about htaccess concepts -- peripheral but vital to PHP for sure.
I've done both.

Sessions can be a little confusing.  The part I got stuck on was custom session handlers, specifically, when the different events fire.  After some in-depth experimentation, I figured most of it out.  My first design for a custom session handler was pretty weak...full of holes, inefficient.  The next one (current version) was better, but still doing too much work.  The next will (hopefully) get it pegged to perfect.  The hardest thing about sessions is remembering that a variable you set STAYS SET until the session expires.  Your application can crash 4 or 5 pages downstream of where the error actually was because you failed to unset a value, and it takes forever to find out why.

It is true that htaccess files are more on the web server side, but server configuration is a fundamental part of a working web app.  I have not used htaccess files much because I don't have a need for that type of customization.  I serve no sites for third-parties, and own my whole server.  My configurations are done through vhost include files (in the main conf include chain), and I force a restart whenever I make a change (which is rarely).  It's the same stuff, though there are some things you can do in an include/vhost that you can't do in an htaccess.  The main differences are what file the directives are in, and the order in which they are applied.

The DB interaction part has always been easy for me, too.  PHP makes it incredibly simple to talk to databases, even at its worst.  It's the db design part that gets tricky.  There are occasions when you suddenly realize that the part of your db you always felt was perfect suddenly needs improvement.  Or maybe you find yourself coded into a dead-end because of a limitation inherent in your design.  Rewrites are the only fix, and those take up a lot of time and energy.  I usually spend a great deal of time designing the database before I ever sit down to write code.  Helps me from having to do the same work twice.
Even sessions and htaccess are only hard until you take the time/trouble to learn them.  Once you do, you will wonder why you ever had trouble.

If you actually find something that is inherently difficult in and of itself, notify the developer responsible and have it fixed :)
routinet -- since you brought up CMS, this is a bit of a side question, but which one do you think is the best for news sites, where the article content needs to be (i.e. should be) totally separate from the CSS / HTML / PHP design of the page?  News writers are not site designers, they just add text into a template w. pics.

I've found that most BBS PHP modules make bad news site CMSs.   Any thoughts?  Any experience?

Cdirenzi -- I found the reverse logic of htaccess very tough to grasp.  If you have not dealt with it, you  are in for a real treat ....  I think next I would have to say dealing with data in server files.  I find the PHP functions much to myopic, almost like dealing with C-code streams.  Didn't like it at all ...  there are others, but what other people found difficult, like DBs, I found very easy.  This was just a "thought" question .....
I've never dealt with any commercial or packaged CMS solutions.  I always made my own, proprietary to the site I was writing.  Most of the one-size-fits-all solutions I see are anything but, and I prefer having to deal with my own code's idiosyncrasies than someone else's.  

My latest evolution is something interesting, though...I'm considering breaking it off into a separate hobby project to see how far I can take it.  I still need to add a real template system...
Interesting comment, routinet, see my profile, send me an email, yours is a bit hard to figure out -- sorry.  You concluded exactly what I did after looking into them.  I'd like to discuss further, but is off topic to this question.   Will wait a day or two for any more input from people with easy / hard preferences.  Thanks.