With a lot of customization with the theme WordPress also provide us to create our own Custom Shortcode. Basically, shortcodes are the small piece of code which let user to add dynamic content in WordPress posts, pages or sidebar widgets.…
Category: PHP
file_get_contents(): SSL operation failed with code 1 certificate verify failed
I got this error when I moved a site to new server. It was a simple file_get_contents() call to read an image file. If i copy pasted the url of the same file to open in browser it would open…
How to know the location of a function defined in PHP
Sometimes you want to know the location of a function defined in your php application. For example you are debugging a large online web application or website. To continue debug you want to enter into a function to debug. You…
How to Get Start & End dates of a Week by given Date
The following function gets start and end date of a week for a given date supplied in valid date string format. In the following function $week is the number of week in the year. For example the current week is…
How to know whether a file exists in URL using PHP
In PHP, to find whether a file exists in disk or on server we have: if(file_exists($filepath)) However is there a way to know whether a file exists in an url, such as, https://www.google.co.in/images/nav_logo242.png?
Create pdf preview thumbnail using php
Following the stackoverlow answer http://goo.gl/z9IWCB I did everything correct as mentioned in the answer to create pdf preview thumbnail using php but I struck with an error as such as this. error no decode delegate for this image format `\path\filename.pdf’…
Fully-formatted Time Difference between two Dates
An useful php function to calculate a time difference between two dates given in sql format. If the newer date is not passed as second argument it would calculate the different between the old date and current time. So it…
Create php array from select options
There are many ways to create a dropdown select options list from a given array in any programming language like PHP. Please check how to create a select list from a PHP array. However in this case I will make…
Useful PHP debug functions
Here are a few useful PHP debug functions. I wrote a similar post sometime ago posting the abbreviated “pr” function as a shorthand replacement for the “prinr_r” or “var_dump” functions. Since then this function has changed a bit so re-posting…
To print the table structure of MySQL table in PHP
You can print the table structure of MySQL table in PHP using simple php script. All you need to do is to make a ‘describe table’ call and process it using php script, similar to one you use to print…