It really depends on how keen you are to learn and how quickly you pick things up. There's certain things you need to understand (variables, data types, functions, conditions, control structures, classes)... once you understand the basics it's really just a case of applying it to different and now advanced situations. It's a bit like playing with Lego. It doesn't take long to understand how to use it and build small things, you just need more practice and experience to be able to build bigger more advanced stuff, but it's all done using the same bricks. PHP is the bricks, what you can build with it will improve over time. I started properly when I was 16 and when I was 18 I had a job using PHP, by 19 I was working as a junior at a top local agency. Put the work in and you'll be fine.
Get a book and read tutorials on the net; there's loads of decent sites to teach you the basics of PHP and once you've got that covered, you'll be able to expand and apply it to anything you want to do. Looking over code to see how it works and writing small scripts to test things and try things out will also help a lot. Once you're confident enough with PHP and want to start writing plugins for things, look over existing plugins to see how they're written and start with something really small, and for each plugin you then make, try and set yourself some sort of target or try something you've not done before.
I'd been using MyBB and supporting users for a while and wanted to know more about how the software and websites in general worked. The first script I ever wrote was when I was in college, must have been some time between 2007 and 2008 I guess. In maths we'd been taught some algorithm for finding what day of the week you were born on based on your birthday and I decided to write it in PHP as a little script. I learnt later you could do the same thing with one line of code using date() and mktime() but that was really the first thing I did. Went from there really, wrote some MyBB plugins and some small sites and now I work as a web developer.
I got tired of spam on my site and on the MyBB Community Forums where I'd have to delete posts, threads, clear out the profile (avatar, signature, profile fields) which all took time, plus some spammers sent people PMs, added calendar events and even reported posts, all of which took time to deal with and would annoy users, and after all that you had to then manually ban them. Goodbye Spammer does all of this for you in one go, taking seconds instead of minutes to completely get rid of a spammer. There are already several plugins to try and stop spam from happening in the first place but there weren't any to help clear up after spam that got through; now there is :)
This is a good technique to use as it saves having to load loads of share buttons on every page load which often slow the page down. Just had to do this and needed a few lines to get it working.
Whether you have the code hidden somewhere on your page before it's needed or load it via AJAX is irrelevant, but once it's included on the page, you need the following code to initialise the buttons.
if(typeof twttr != 'undefined')
If you add one Tweet button dynamically it seems to initialise itself, but later ones need this code. As well as this, 'twttr' won't exist until the first one is created but will after, so we only need to run that once it's defined; isn't needed for the first one anyway.
For the Facebook one, you need to specify the ID of a container of the post or something, and it'll find any FB elements inside that it needs to initialise.
After that, should work fine.
Not yet, I want to learn Python and Ruby at some point but haven't had the time to commit to it. I want to try and expand my skills if I can at some point though.
Over the past few weeks I've been writing a new site and it's at a state now where I can replace my current one. WordPress is good but has loads of stuff that I don't use and I don't really know how it works, and I've always wanted to build my own site, so here we go.
As you can probably see, I'm not a designer, but sometimes less is more. Think it looks alright myself.
I've built this using the Kohana PHP framework (the older one as we use it at work and I know it, couldn't be bothered to learn a newer framework as I just wanted to get this built) and Twitter Bootstrap as the front end framework, which I now love. It makes the site responsive (scales nicely to fix widescreens, normal screens, tablets and smartphones) and comes with loads of utility styles to save you loads of time. That's what I like about using frameworks, they save you writing all the crappy boring stuff and let you get straight into building what you want.
I've also got a little Ask Me feature like Tumblr/Formspring so feel free to ask me something if you have nothing better to do.
Things will probably be a bit broken but I'm sure I'll find the problems myself soon enough.
I've imported some of the better/more recent posts from my old site (which can still be found here). Please forgive some of the silly things I went on about when I was a bit younger.
If you have any feedback on the site then please let me know as I'll always be looking to improve it.
I'll also try to use this one a bit more than my old one too :)
Only a few days after I finished my PHP day of birth script, I wrote my first proper MyBB plugin. My first plugin was a Return to Top postbit button, but I'm not really counting that :P This plugin will add a message to the index of your forums if a member is awaiting activation, and you have account activation set to either email or admin activation. You can choose to turn the message on or off, specify a different title for the email/admin message, and a different message for the email/admin message. The message will display in your theme's style and is collapsible. I've wanted this for a bit but really wanted to do it myself, so once I'd furthered my understanding of the basics, I tried, and got it finished quite quickly. I had to look at how some other plugins were made, mainly to see how to setup the settings, and how to make the template changes. Anyways, I managed to create it quickly and with hardly any problems. It's now been downloaded a few times already and I've had good comments back, which is great. It was a good first plugin idea, and it turned out even better than I planned. It's available for download from the MyBB Mods site, where you can also see screenshots, and the discussion thread can be found here. I already have another idea for a plugin, which may be ready in a week or so, once I have time to get it right.
Well, the other day, after reading the basics in books and on the net, I wrote my first little PHP script. It isn't much really, but I'm still really happy with how it's turned out. What it does, is tell you the day you were born, based on the date. So for example, 17 June 1991 (my birthday) was a Monday, and if I put that into the form, it will tell me that. Magic.
Well no it isn't magic, the main workings of it is just a mathematical formula that I was taught at college, but I thought that would be a good thing to write a script on. The script itself is relatively basic, it just takes the values from the input form, assigns them to variables, does some stuff with those, then puts it through the calculation to get a number from 0 to 6 (Sunday to Saturday). Then I wrote out a load of if, elseif and else statements to show the actual day. I also put in some statements for if you put in a day that doesn't exist, (30/31st Feb, 31st Apr, Jun, Sep, Nov), if you try and select 29th Feb in a non-leap year, and also if you try and select 29th Feb in a non-century leap year (a century year is only a leap year if divisible by 400, so 1200, 1600 and 2000 were century leap years). So, although it's quite basic, it's been a big learning curve for me, and I've learned a lot from such a small script, especially how to get information from a form, and it helped me understand if, elseif and else statements a lot more.
The script itself is at least 99% accurate. There's not many dates that won't work, and the ones that don't are either hundreds of years ago, or in 2000+. I'm not too sure why it breaks with years that are 2000+, I think the formula ends up having to divide by 0 with those years, and dividing by 0 isn't mathematically possible.
I'm probably making a big deal out of something quite pathetically small but it's the first thing I've ever written that actually works so I'm quite pleased.
You can test the most stable version, with years from 2000 onwards disallowed, here. To see the one that allows years that are 2000 onwards, see here.
Hopefully now I've started to understand this stuff more, I'll be able to do much more, much quicker.