Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Piccia Neri8,937 Points
Difficult to understand the application of php
Hi there, I understand the explanations but the course doesn't really make me understand what all of this serves for in the real world. It would be much more useful to see real examples in an existing website. Like this, it is all abstract and I don't really see the point of it. For instance do I use an array for? what's a practical application of it? no idea. Can we see applied examples?
Andrew Shook31,709 Points
A real world application for PHP would be Facebook, which is written in PHP and Hack ( a custom PHP like language developed by Facebook). Like Logan mentioned, PHP is used, along with MySQL, to generate web page content on the fly. For example, Facebook doesn't have a static html page for every one of it's user's news feed. Instead, it most likely ( I don't work for Facebook so I'm not 100% sure) using a single html template with PHP to display all news feed for every user. In essence what happens when you go to your news feed is that FB takes you user name and look's you up in their database ( PHP is used to make the DB request and to determine which user you are). Once it retrieves your info from the DB, FB using some logic and your user settings to determine who's post and their order for your news feed. Then It makes another DB call to get the posts for your news feed. The post are likely retrieved from the DB in an array, and then that array is looped through to display the posts to your news feed.
I this give you an idea of what PHP is used for. I know my example is a little vague. Unfortunately, treehouse's php course is a little lacking. You can find courses on basic PHP, and the WordPress and Laravel ( both of which are written in PHP), but not any courses that going into detail about how to implement PHP. I wish treehouse would do a Treebook series like they did with php. I think that would help people get a better feel for PHP.
Piccia Neri8,937 Points
Thanks everyone – thanks Jo, I did think about the Build a Simple PHP application course and I will probably do it now. That's why the other Treehouse courses work so well, because you learn by making.
I do know what PHP is for, but the way the course is conceived does nothing to explain why it is useful, and when, and how I could use it. It's good to know that an array stores information, but what do I do with it? if you see what I mean. The course just doesn't show it and I ma getting bored.
The only reason why I want to understand PHP is because I want to understand Wordpress inside out. Treehouse have just changed the Wordpress track (which before had the Build a PHP application course inside it): now they say that to do the Wordpress course, they assume you already know PHP. Well, in my opinion this change is not an improvement at all. If anything, they should have done the opposite: a PHP course for Wordpress users. No such course exists, alas. There is literally NO course out there that explains just HOW Wordpress uses and needs PHP. They all 'assume' you know PHP.
But the only reason why I need PHP is because of Wordpress, so a Wordpress course should really contain a unit called 'PHP for Wordpress'. It would be so beautiful, so helpful, so simple. I have access to many PHP and Wordpress courses and not one does this simple thing. Wordpress courses assume PHP knowledge, while PHP courses all start from something completely abstract and talk about eyes colours etc and they completely lose me, I totally lose interest because what they are showing me has no obvious use to me without an example of a practical application.
The main selling point of the Wordpress track on Treehouse for me was precisely the fact that it contained a PHP course, so I thought that perhaps FINALLY someone would have thought to explain how the two work together – but no such luck. I absolutely love the Treehouse courses otherwise, so please can someone take heed? can we have a PHP course that deals specifically with Wordpress? I am never going to be a PHP developer but I do need to understand it because of Wordpress.
Thank you all!
Logan R22,989 Points
I actually kinda thought like you did when I first used PHP too. I didn't see a lot of point to learning it. The thing that really changed my opinion was when I started working with databases. I could take user information, like usernames, how much money a user has, etc, and DO things with it. I could create cool applications that people could interact with. I don't know if that makes much sense or not.
As for arrays, they are just simply a list of items. It's an easy way to store the list and the information inside of them and you can also manipulate the lists very easily. If you want to store a shopping list, you would create an array called "Shopping List" and list your items, such as "Apples, Milk, etc".
The OP's point is valid and this is the reason why I've had so much trouble learning php. Very few programmers are good teachers. We really need real world tutorials. Teach us php for making apps that people use in the real world like tinder, pof, or facebook.
There's no point in learning a bunch of php functions if you will not be taught how to apply them to make useful apps.