Hey all,

I have a php query to calculate numbers and fix them.

Say I have the following set of numbers:

2.38
3.4
3.45
10.3
8.1
5.07
4.8

I want all the numbers to be aligned, so the numbers that are 3.4, 8.1, 4.8 etc should have an attached 0 (zero) on the end of them, so the numbered output would be:

2.38
3.40
3.45
10.3
8.10
5.07
4.80

How does one do this?

$zero = 0;
			if(strlen($backodd) == 3) {
				$backodd = "$backodd$zero";
			}

Nevermind.. Figured it out myself with the trusty strlen :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.