Tag Archives | PHP

Laravel Logo

Laravel 4 – Pivot vs Polymorphic – Part 1

PHP has come a long way! Coming from the Rails world back to PHP has actually been pretty painless thanks to Laravel. One of the first things that stumped me was under what circumstances to use pivot vs polymorphic relationships. This post is more of a reminder for myself but I hope it clarifies things […]

Continue Reading 2

PHP: Handle comma separated input

A quick example of how to handle comma separated input from a POST variable in PHP. The code below will turn your POST variable into an array containing the user’s input which you can further validate or store in a database. This is useful for letting users add tags to items on your website.

Continue Reading 1

Check image type in PHP

Quick PHP tip: If you’re looking to determine the type of uploaded image you can use the following code:

The code above shows a snippet to check if the uploaded image was a jpg, gif or png image type. As stated on the PHP documentation, this will return the same value as getimagesize() but […]

Continue Reading 0

PHP base_convert() in AS3

Here is a quick example of how to use PHP’s base convert function in AS3. A lot of people use this function for shorter masked URLs like YouTube. Easy enough but took me a minute to find the equivalent in actionscript. PHP:

Actionscript 3:

Continue Reading 0

Getting Upcoming Birthdays From MySQL

Assuming you have a table called users with birthday as bday for the column name, this will pull all users who are having a birthday in the next 7 days. This is very useful if you want to showcase your member’s birthdays on your website.

There is of course one small problem with this, […]

Continue Reading 7

Powered by WordPress. Designed by Woo Themes