 |
|
| Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more. |
|
 |
|

03-28-2012, 08:58 PM
|
 |
Junior Member
|
|
Join Date: 03-28-12
Location: British Columbia, Canada
Posts: 21
|
|
|
How did you learn php?
Hey folks, I'm in the process of learning php right now. I am just curious about how other people on here learned to code. I'm watching tutorials on youtube and coding along with the videos. It's hard for me to grasp how I would make a large project a reality though.
I've had an idea for a website since the end of 2011, and ever since then I've been trying to make it a reality. I didn't pick an easy concept though. It will require HTML, CSS, JavaScript, and lots of PHP from what I can tell.
I've heard some people say reading code can be a good way to learn. Does anyone have a suggestion for places I can read well coded php?
Thanks a bunch.
|

03-28-2012, 09:41 PM
|
 |
Junior Member
|
|
Join Date: 03-28-12
Location: Kelowna, BC, Canada
Posts: 27
|
|
|
I actually learned back in high school when Spoono was still active as a legit source of information.
Honestly, the best way to learn PHP: Do it.
Experiment.
make php.net your homepage
ask in forums like this for guidance
Come up with common achievable challenges in small doses like:
1. How do i include files with php?
well this would be <? include('filename.php'); ?>
2. How do i upload something?
3. How do i make a login?
Doing quick google searches will come up with hundreds of tutorials from various sources on how to accomplish these tasks.
Obviously coming up with obscure topics will yield less results...
-- This is all personal opinion past this point:
IF YOU WANT MY HONEST TO GOD OPINION: Learn OOP as fast as possible. It gets increasingly more of a barrier to learn it the longer its avoided, I've been encouraging ALL of my peers new and old to move from procedural "in-time" coding practices to Object Oriented Programming Standards at the very least even just using common structs.
<?
// Example OOP class in PHP:
class Person {
public $first_name = null;
public $last_name = null;
public function __construct($firstname = null, $lastname = null) {
if($firstname != null) $this->setFirstName($firstname);
if($lastname != null) $this->setLastName($lastname);
}
public function setFirstName($name) { $this->first_name = $name; }
public function setLastName($name) { $this->last_name = $name; }
public function getFirstName() { return $this->first_name; }
public function getLastName() { return $this->last_name; }
public function getFullName() { return $this->getFirstName()." ".$this->getLastName(); } // shorter
public function getName() { return $this->getFullName(); } // alias
}
?>
This class can be used plenty of times to store this kind of information with getters and setts (as such int he example)
<?
$person = new Person();
$person->setFirstName("Derrick"); // the -> allows you to access properties (variables) and methods (functions) in the class
$person->setLastName("Zoolander");
or
$person = new Person("Derrick", "Zoolander"); // would yield the same result with the class above, the __construct function gets called when you throw a "new", making a new "instance"
to get that info?
<?=$person->getName();?>
or
<?php
echo $person->getName();
?>
this little example only scratches the surface, OOP is ridiculously powerful and immensely useful! It may look like more typing than necessary, but the benefit is if done right, you can reuse the code in ANY project after you write it, not to mention reuse it for the rest of the project where necessary.
If you are interested in learning more about PHP OOP, feel free to ask!
/gah im rambling... sorry!
Last edited by DJDarkViper; 03-28-2012 at 09:48 PM.
|

03-29-2012, 01:42 AM
|
 |
Contributing Member
Latest Blog: None
|
|
Join Date: 11-03-11
Location: Austria
Posts: 1,206
|
|
Well, best way to learn is by coding something, but that is easier said than done. But I found some resources that teach you how to code and also give you something to code. For example
Code:
http://tut.php-quake.net/en/index.html
Teaches you what you need and then gives you something to try. a News Script, a Guestbook even a browsergame. Something you can even use for your website, if you like.
Another good resource is the free eBook from tuxradar
Code:
http://www.tuxradar.com/practicalphp
A bit old, but still valid...
Cricket already posted the PHP 101: PHP For the Absolute Beginner guide, which is the one which I started.
|

03-29-2012, 01:56 AM
|
 |
Junior Member
|
|
Join Date: 03-28-12
Location: British Columbia, Canada
Posts: 21
|
|
Wow thank you guys so much for all this information! How long after you started learning did it take to get to the point of basically being able to code anything you could imagine? I can't wait till my skills get to that point. Just need to keep up the hard work I've been putting in this year I suppose
|

03-29-2012, 03:40 AM
|
 |
Super Moderator
|
|
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
|
|
|
Ben, I am self taught and still learning. I tend to learn better when I see a clear and present need. I don't do well with abstract theorems.A part of my learning process was the study of the work of others dissecting scripts.
In time you will get to the point where you can do your large project for the simple reason that the most complex set of scripts starts with one line of code and is usually built in modules or processes.
A student studies, a teacher teaches and a coder codes something. I must agree with several of the above posts, write a simple script.
|

03-29-2012, 07:47 AM
|
 |
Junior Member
|
|
Join Date: 03-28-12
Location: Kelowna, BC, Canada
Posts: 27
|
|
Honestly it didnt take long at all, but figuring out your own coding style and ultimately your own workflow of efficiency for nice clear systems: that takes years of hardcore practice.
Honestly, learn the basics of PHP (Includes, Variables, Functions, Arrays, and Loops) and then learn MySQL (Select, Insert, Update) or Flatfile database (fopen/fwrite) systems (only if mysql is unavailable ahha) and you will be able to do literally anything you can imagine pretty quickly  But as with anything you will simply just get better over time simply by using the language, you will find tricks, shortcuts, basically your own bad and good habbits just by overcoming challenges of evelopment hurdles!
|

03-29-2012, 07:57 AM
|
|
Banned
Latest Blog: None
|
|
Join Date: 05-01-06
Location: I live in the real world!
Posts: 329
|
|
I am self-taught and the majority of my time spent on any questions I had were spent on php.net.
I agree with DJDarkViper on getting to know OOP.
While I feel I can most certainly hold my own in php, I do lack in the use of classes as DJ exemplified above.
When the time comes though I will buckle down and grasp it all.
As far as timeline goes, it took me roughly two weeks to teach myself php, smarty, the knick-knacks of mysql and the script for which I was learning it all for.
P.S. - I am not ego-driven and am always open to learn and read up on any coding/scripting language; So with that being said, if you have some good book, site and/or website references for classes and OOP development, DJ, feel free to post.
Also, I enjoyed what you considered a 'rant'
|

03-29-2012, 09:15 AM
|
 |
Junior Member
|
|
Join Date: 03-28-12
Location: Kelowna, BC, Canada
Posts: 27
|
|
Hey An0n!
XD thanks, I am a very late bloomer when it comes to OOP, and it was an extremely tough mental hurdle for me to overcome, but at my job it became a requirement as I was hopping around three different OOP based or capable languages and I wanted to streamline my workflow.
Between PHP, Java (for Android and Blackberry dev), and C# (Internal tools and WP7 development) I wanted my code to look and act largely the same across all of them, so i just came up with a happy medium.
Some could consider my code "heavy use" and not very efficient at all, but honestly I cant think of a better way to bring in the same level of functionality with the same level of flexibility.
I am pretty much self taught, though i've had the help of some amazingly talented individuals at my job to smooth out my rough spots (when i joined the company, I had no idea what a JOIN in mysql was or did).
A great way to learn OOP I find, is to be exposed to it by as much force as possible. Download Codeigniter, which is an MVC OOP framework and check that out (or alternatively, I built a framework largely inspired by CodeIgniter, found here: github.com/DJDarkViper/Black-Jaguar-Framework ) that i've used in a couple production sites so far. Couple small bugs to fix but ill get those ironed out sometime this weekend i think..
PHP.net man, its my magical tome of knwoledge XD (Stackvoerflow also helped me a great deal in understanding the point of why i'd want to use OOP in the first place lol)
..im rambling again
|

03-29-2012, 10:00 AM
|
 |
Contributing Member
|
|
Join Date: 11-30-11
Location: Orlando, FL
Posts: 220
|
|
Ten years of boredom and trying to make websites for fun.
|

03-29-2012, 11:03 AM
|
 |
Junior Member
|
|
Join Date: 03-28-12
Location: British Columbia, Canada
Posts: 21
|
|
|
I learned the basics of OOP in JavaScript, but haven't really gone over it in php yet. I've only really coded two things in php that didn't have to do with lessons. One was a program that echoed out 99 bottles of beer on the wall 99 bottles of beer.. etc, down to 0. The other was FizzBuzz if you know what that is. They are pretty darn simple things but I did get excited when I was able to make something do what I wanted.
You guys really are giving me motivation to keep learning. Thank you all so much.
|

03-31-2012, 06:19 AM
|
|
Contributing Member
|
|
Join Date: 01-01-04
Location: Kansas, America!
Posts: 142
|
|
I have a tutorial with the 10 functions I used the most, it's a quicky one-page thing:
http://spacefem.com/tutorials/phpfast.shtml
But basically I learned by hacking my phpbb installation. And some book I got off the bargain table at a store in 2001 or so.
No matter what your first big project is, it will not be "well coded", lol. we're always learning and always making things better. just jump in and do what you want to do! then in a year, go back and redo it!
I brought down a server by putting a sql query in a loop, I made a whole website without "notice" errors turned on and then turned them on later only to realize how many disasters I had, I made a million "forgot to check for null"-sort of mistakes. and I'm still pretty much a hack. but I'm a much better hack than I used to be!
|

03-31-2012, 06:36 AM
|
 |
Super Moderator
|
|
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
|
|
Quote:
Originally Posted by spacefem
I brought down a server by putting a sql query in a loop, I made a whole website without "notice" errors turned on and then turned them on later only to realize how many disasters I had, I made a million "forgot to check for null"-sort of mistakes. and I'm still pretty much a hack. but I'm a much better hack than I used to be!
|
Fear of doing that very thing is what motivated me to install an Xampp server on my local machine. I can always power down without hurting other users.
|

03-31-2012, 10:12 AM
|
 |
Junior Member
|
|
Join Date: 03-28-12
Location: Kelowna, BC, Canada
Posts: 27
|
|
Quote:
Originally Posted by ScriptMan
Fear of doing that very thing is what motivated me to install an Xampp server on my local machine. I can always power down without hurting other users.
|
And Xampp (and especially WAMP and mamp) inspired me to install Ubuntu on my laptop and run a local LAMP that directly mirrored the settings and capabilities of my target server so i'd never have to suffer through another "..well it worked on MY machine WHAT THE FU- GODADD- AUUGGGHH!"
that.. and many private bitbucket repos have helped save my sanity XD
|

04-01-2012, 02:18 PM
|
|
Junior Member
|
|
Join Date: 03-24-12
Posts: 6
|
|
|
I started by searching google for something that I know I wanted to do in PHP then took it from there. Tons of nice people on the net posting their code for you to look at.
|

04-01-2012, 05:05 PM
|
|
Junior Member
|
|
Join Date: 04-15-11
Posts: 5
|
|
|
I like the O'Reilly Head First books. But I actually read their earlier PHP/MySQL book.
I confess I already was a deep perl guy, and PHP really isn't that much of a jump. Actually, perl/python/ruby/php - they're all very similar once you know functional and OOP programming.
My advice is to read a solid book, and then spend lots of time writing it.
|

04-02-2012, 06:08 PM
|
|
Contributing Member
Latest Blog: None
|
|
Join Date: 03-05-12
Location: Canada
Posts: 55
|
|
|
I taught myself at w3school.
The key is not to get discouraged. You're not going to start off with a massive project.
Start out small, like VERY small
Make a simple website, no graphics or anything. Just a white page that changes the sentence it displays every time it reloads.
Once you have that, try a for loop that count's up to 10.
Make the same look using a while statement.
Once you've done that, try creating the page as a function and then calling the function to generate the page.
Basically, just add simple functions and play around with them. Before you know it, you will know your way around code.
|

04-03-2012, 02:39 AM
|
 |
Contributing Member
|
|
Join Date: 07-05-11
Location: philippines
Posts: 312
|
|
Quote:
Originally Posted by ben.d.h
Hey folks, I'm in the process of learning php right now. I am just curious about how other people on here learned to code. I'm watching tutorials on youtube and coding along with the videos. It's hard for me to grasp how I would make a large project a reality though.
I've had an idea for a website since the end of 2011, and ever since then I've been trying to make it a reality. I didn't pick an easy concept though. It will require HTML, CSS, JavaScript, and lots of PHP from what I can tell.
I've heard some people say reading code can be a good way to learn. Does anyone have a suggestion for places I can read well coded php?
Thanks a bunch.
|
before diving-in to codes of an existing website or go into advanced codes, you need to learn first the basics..
http://www.tizag.com/ can introduce you to some basic things on learning website development..
|

04-21-2012, 04:59 AM
|
|
Junior Member
|
|
Join Date: 01-15-12
Posts: 5
|
|
|
according to me w3schools is the best place to learn php,html,css etc
|

04-21-2012, 05:30 AM
|
 |
Super Moderator
|
|
Join Date: 12-31-07
Location: Medford, NJ
Posts: 42,735
|
|
Quote:
Originally Posted by obaid.ahmed
according to me w3schools is the best place to learn php,html,css etc
|
Anymore helpful advice for the thread creator?
Quote:
Originally Posted by ben.d.h
Hey folks, I'm in the process of learning php right now. I am just curious about how other people on here learned to code. I'm watching tutorials on youtube and coding along with the videos. It's hard for me to grasp how I would make a large project a reality though.
I've had an idea for a website since the end of 2011, and ever since then I've been trying to make it a reality. I didn't pick an easy concept though. It will require HTML, CSS, JavaScript, and lots of PHP from what I can tell.
I've heard some people say reading code can be a good way to learn. Does anyone have a suggestion for places I can read well coded php?
Thanks a bunch.
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
Best way to learn PHP?
|
Midwifery Online |
Coding Forum |
20 |
12-01-2010 07:51 AM |
|
Here to learn.
|
Kivalight |
New Member Introductions |
5 |
11-21-2010 07:29 PM |
|
Best way to Learn
|
jemagee |
Coding Forum |
12 |
10-11-2006 12:28 PM |
|
Learn CSS
|
SN3 |
Web Design Lobby |
6 |
11-09-2004 06:52 PM |
All times are GMT -7. The time now is 10:00 PM.
Powered by vBulletin Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP
|
|
|