This might be helpful to you;
http://static.zend.com/topics/0200-T...ons-in-PHP.pdf
The table is locked during writes, not reads. So in your example the table would only be locked at line 1000 and would be unlocked as soon as that SQL query was processed.
The main thing to keep in mind about PHP and programming for the web in general is the fact that web servers are
stateless. This is why the way data is read/written/used may seem odd to you at first. The methods are different because everything is generated at runtime and destroyed at the end of script execution.
A web server can handle more than one request at a time. What I was trying to get at is requests are put into a queue and processed in order based on time. Processes can also claim exclusive access to a resource (like session data or MySQL tables in the case of writes) and all other requests will be forced to wait before working with that resource in some cases (example; I can read data from a table you're writing to but I can't write to that table until you finish.) Also remember that we are talking about microseconds-milliseconds here.
Also you should keep in mind that what you're getting at is not a very big deal because all the client has to do is load another page on our forum to get the most recent copy of the cache (or any other data stored in the database).
Did that answer your question? I kinda feel like I'm dancing around it or not begin clear. I'm personally moving in the opposite direction you are..I started my programming voyage on the web and now I'm moving into C, C++ and a few assembly languages. I know as well as you do how confusing it can be learning a new programming language even if you have experience in another. You should pick up on PHP quickly though if you stick with it. Just try to roll with things and not get so hung up on the many ways PHP is not like Java.
Oh one more quick thing. If you're new to PHP and are learning it with vBulletin a word of advice; Don't assume vBulletin is how PHP applications should be coded. vBulletin has a few growing pains and the source really shows it. If you're interested in learning PHP in general and using it outside of vBulletin I recommend going over to Sitepoint (and there are many other good sites) and reading about PHP5 and the OOP features. Here is a link to Sitepoint's PHP tutorial section;
http://www.sitepoint.com/subcat/php-tutorials
There are also many good books on PHP if you're like me and link things in print.
If you need any more help just let me know.
- Brad