Khor Shuqi

Some Simple PHP Functions that I Find Useful

I’ll keep this list updated. stop() We use this function to gracefully stop the program in place of exit. We used to close all DB connections within this function, but it’s seemed no longer required to close manually, so sometimes we just do some data logging here. is_num() and is_id() It’s funny that in PHP, most…

Read more

Force Toggling a CSS Class

One of the things I found pretty useful when dealing with Bootstrap theme is the ability to force toggle a CSS class with Javascript. Let’s say, you have a select menu with ‘Other’ option, and you would like to display a text input when ‘Other’ is selected: Instead of using if-else statement to show or…

Read more

New DNS Zone on Facebook?

Have you noticed recently that when you browse Facebook on your laptop, it’s no longer “www.facebook.com” but “web.facebook.com”? I’m not sure if this subdomain has existed earlier in other places, but I have only just seen in Malaysia since December 2022. The Impact If you’re just a regular user, then it might not affect you…

Read more