Archive for category php

Simplest way to remove trailing zeros of decimal numbers

This is a simple method I found to remove or strip trailing zeros of a decimal number. The function accepts the decimal number and return the trimmed value back. It removes all the redundant zeros in the number after the decimal point and if no number other than zero is present after the decimal point the decimal point too is removed.

Continue reading “Simplest way to remove trailing zeros of decimal numbers” »


, , ,

12 Comments

Print Array in PHP

There are various methods and commands used in PHP to print an array of elements. They are different in the way they print the array elements.
I will cover three main ones I usually use.
Lets assume an array as follows to explain the various types of printing.

Continue reading “Print Array in PHP” »


, , , , ,

2 Comments

Check if a table exists in MySQL from PHP

Sometimes its necessary to execute a query or execute some code if a table exists or not. So a bit of searching got me to the conclusion that mysql doesn’t have a direct query or method for it from php. So there are two methods to do it. Continue reading “Check if a table exists in MySQL from PHP” »


, , , , , ,

1 Comment

Fix link issue in Twitter client of Fusion theme

When I tried out the Twitter client in fusion theme I noticed that the urls are wrong in that client. The URL in my client were like http://blog.sriunplugged.com/”http://search.twitter.com/search?q=%23Home” . So after a bit of digging into I found that the file wp-content/themes/fusion/functions.php contains the php code for generating the contents of widget. So the issue was that it was echoing the contents as such after getting from twitter. So Twitter already has quotes in the link this was the one that was making link wrong. So the fix was a small. Insert into the function fusion_TwitterWidget() the line mentioned below
Update: I edited the function again to add my twitter link too.

Continue reading “Fix link issue in Twitter client of Fusion theme” »


, , , ,

3 Comments