Teach yourself PHP, Lessons 1 and 2
I’m learning php.
Mostly I’m doing it because I want to be able to hack my blogs, both of which use some php (more for this one, somewhat less for The New, New Podcast Review). Maybe also writing a plug-in or two for WordPress.
Currently we’re not talking about using a book (although I have several) but about really teaching myself php. taking apart the source code of WordPress and figuring put what it does in the places that I want to change, and using that to figure out the php syntax. Kind of the hard way around, I think, but I don’t have time to read a whole book right now.
So a couple of days ago I had Lesson 1: “Escaping characters and concatenating strings”.
- who ever heard of using “.” to concatenate strings? WTF? Well, I’ve got it now.
- and, in the “it took me waaaay too long to figure this out” category, I should have been able to figure out that “” is used to escape “special” characters in php. I mean it’s not like other languages don’t do the same thing. But because of my idiocy it took me way longer than it should have to hack Garrick Van Buren’s WordPress Category Technorati Tag Plugin to display
instead of
<img src='http: //kinrowan.net/blog/wp/wp-content/plugins/technoratibubble.gif'>
This morning I learned Lesson 2: “‘Not’ and ‘If structures’”
- Apparently saying “if not (…)” doesn’t work. Haven’t figured out what does - I just picked a different one of the 400+ most excellent WP functions to do the job. Probably something like replacing the “not” with “!”.
- “:” separates the “if” structure from the activities it controls. Interesting…
OK, maybe the book would be worth the time….