Press enter to see results or esc to cancel.

Abraham Garcia Abraham Garcia in PHP Scripts   Monday, August 8 2016

How to get all Wednesdays of a Month PHP

A PHP function on how to retrieve a certain day from the week like Wednesday. Grab every Wednesday from the week.

The other week i had to figure out how to get all wednesdays from a week. While browsing online i found something on stackoverflow that i think might help you guys writting this function.  With PHP5.3 function getWednesdays($y, $m) {

Continue reading
Abraham Garcia Abraham Garcia in PHP Scripts   Friday, March 18 2016

Array Search in Query Where Statement

This is a small example on how to run a query with an array inside the WHERE clause. I hope this can help you in your projects.

This is a small example on how to run a query with an array inside the WHERE clause. I hope this can help you in your projects.  $ids = array( "1", "2", "3", "4" ); $idsStr = implode(',', $ids); SELECT * FROM table WHERE id IN

Continue reading
Abraham Garcia Abraham Garcia in PHP Scripts   Friday, February 12 2016

How To Get Gravatar Image via PHP

How to get Gravatar image and insert it into your projects with a simple function

This is a useful function to get the gravatar image into your projects. $email = "someone@somewhere.com"; $default = "http://www.somewhere.com/homestar.jpg"; $size = 40; $grav_url = "http://www.gravatar.com/avatar/" . md5( strtolower( trim(

Continue reading
Abraham Garcia Abraham Garcia in PHP Scripts   Tuesday, December 8 2015

How to Set Width on Imagine Framework

Learn how to use imagine image class. Use this to resize widen image and keep aspect ratio.

This is a tutorial on how to set width only on image. This is done with widen function. This is very useful when you want to size an image to a certain width and keep aspect ratio for the height. $imagine = new \Imagine\Gd\Imagine(); $image =

Continue reading
Abraham Garcia Abraham Garcia in PHP Scripts   Sunday, September 27 2015

How to Extract an HREF from a String in PHP

An example on how to get the href from a string using PHP Function SimpleXML.

In order to extract an href from a string in PHP we can use the PHP Function SimpleXML.  How To:  $a = new SimpleXMLElement('<a href="www.thecodebeast.com">Click here</a>'); echo $a['href']; // will echo www.thecodebeast.com

Continue reading
Abraham Garcia Abraham Garcia in PHP Scripts   Friday, September 25 2015

How to separate an Array into a comma string inside foreach loop in PHP

Example on how to separate an array into a comma string using PHP. Useful for multiple POST checkboxes.

This is an example on how to separate an array into a comma separated string. I use this for multiple checkboxes POST and add all the checkboxes values into a string.  POST Example <input type="checkbox" name="checkbox[]" value="A">

Continue reading
My Favorite MailChimp PHP Wrapper - API Integration
Abraham Garcia Abraham Garcia in PHP Scripts   Wednesday, September 23 2015

My Favorite MailChimp PHP Wrapper - API Integration

The MailChimp PHP API Written by Drew McLellan is one of the most simple API out there. How to Add Emails to MailChimp List with PHP.

My favorite MailChimp PHP Wrapper is simple. This API wrapper was written by Drew McLellan. I will go on some brief instructions on how to use the API wrapper. Here is the Documentation for the API Wrapper.  GETTING STARTED First you need

Continue reading
Abraham Garcia Abraham Garcia in PHP Scripts   Friday, July 17 2015

Create a TInyURL with PHP

How to create a TinyURL with PHP. This is a script created by David Walsh.

Use the following php script to create a TinyURL. This script was created by David Walsh we love this script we use it all the time. //gets the data from a URL function get_tiny_url($url) { $ch = curl_init(); $timeout = 5;

Continue reading
How to Get YouTube Video Image Thumbnails
Abraham Garcia Abraham Garcia in PHP Scripts   Thursday, April 23 2015

How to Get YouTube Video Image Thumbnails

How to get your youtube video image thumbs. Use this in your project when you need the image thumb generated by Youtube in your projects.

In order to get the video thumbnails that YouTube generates we can use the following links.  http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg

Continue reading
Abraham Garcia Abraham Garcia in PHP Scripts   Tuesday, April 21 2015

Limit String Characters Without Cutting Them in PHP

This function is an alternative to substr. The function substr can cut your words in half so this function works great in order to prevent cutting words in half.

I have always user substr, but it become annoying when it cuts strings or words in the middle. I used to use substr for small blog description before getting to the full blog post. This function has saved me. This does not cut your string in

Continue reading