commas
Print Array Without Trailing Commas In PHP
Fri, 04/24/2009 - 09:10 | by philipnorton42I have previously talked about Removing commas from the end of strings, but it is also possible to use the implode() function to do the same sort of thing.
implode() takes two parameters, the separator and the array, and returns a string with each array item separated with the separator. The following example shows how this function works.
Delete Trailing Commas In PHP
Tue, 04/14/2009 - 10:49 | by philipnorton42Converting an array of information into a string is easy, but when you are doing this for insertion into a database having trailing commas is going to mess up your SQL statements.
Take the following example, which takes an array of values and converts them into a string of values. This practice is quite common in PHP database manipulation.
Format Numbers With Commas In JavaScript
Thu, 07/31/2008 - 09:18 | by philipnorton42I found a good function that details how to format numbers with commas in JavaScript and thought I would reproduce it here. It basically takes any number and turns it into formatted string with the thousands separated by commas. The number_format() function is available in PHP and I have been relying on PHP to sort out the formatting before returning it via an AJAX call. I can now include this function into my JavaScript library and do this on the client side.