Josh Time | Joshua Li

CAT | Tutorials

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 [...]

· · · ·

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 [...]

· · ·

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 [...]

· · · · · ·

Jan/10

9

Faster alternative to settype()

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 [...]

· ·

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 [...]

· · · · · ·

Dec/09

8

Page Glimpse Tutorial

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 [...]

· · ·

Theme Design by devolux.nh2.me