CAT | Tutorials
28
Normal Functions vs Anonymous Functions: Speed and Extensibility
No comments · Posted by joshtime in PHP
PHP5.3 comes out with a new anonymous function feature. This new feature adds a lot of new flexibility to PHP scripts. What caught my eye more is that a function can be stored inside a variable. Normal functions can not be unset. This is usually fine. But, when inplementing a plugin system to a php [...]
anonymous functions · function · PHP · plugin · speed
30
Adding Separator Between List of Items with PHP
2 Comments · Posted by joshtime in PHP, Tutorials
This is my first real PHP tutorial on this blog. I hope you enjoy it. Level: Easy Ending result: Item 1 | Item 2 | Item 3 | Item 4 Sometimes, a script may want to add a separator between items in a list. This is not as simple as it seems though. In this [...]
list · list of items · PHP · separator
20
Faster PHP Hit Counter (Counting Number of Views with MySQL)
2 Comments · Posted by joshtime in PHP, Tutorials
Sometimes, a PHP script may want to keep track of how many times the page has been viewed. The normal solution would be to do: mysqli_query(“UPDATE `table` SET `views`=`views`+1 WHERE `page`=5″); But, what if your site gets very high traffic? Then, the MySQL would be overloaded. A fix to this would be to use a [...]
I was working on Coal Games today and then I looked up settype. michaltrutman wrote this on http://php.net/manual/en/function.settype.php. You can change variable type also in another way instead of using function settype(). You can change variable type also in another way instead of using function settype(). <?PHP $a = ’125′; //$a is string var_dump($a); $a [...]
alternative · PHP · settype
28
Alternative to mysqli_fetch_all PHP Function for MySQL
No comments · Posted by joshtime in Tutorials
While I was coding today, I tried to use the function mysqli_fetch_all on my PHP 5.2 installation. Unfortunately, this function only works on PHP 5.3 and above since it uses the new mysqlnd driver. I had to come up with a pseudo alternative to the function mysqli_fetch_all. The following is the code I came up [...]
5.2 · 5.3 · alternative · MySQL · mysqli_fetch_all · mysqlnd · PHP
This is my first ever tutorial on JoshTime. Page Glimpse Page Glimpse is a online service that generates screenshots of a webpage (that is cached) and then sends it to a user through a very simple API. This service is completely free. To use a screenshot of a webpage, only a GET or POST is [...]
IE7 · image · Page Glimpse · screenshot
