Jump to content

How can I align digit


john7911

Recommended Posts

Or you can use printf() (as Benanamen suggested) between <pre>..</pre> tags

echo '<pre>';
for ($i=0; $i<= 180; $i+=15) my_function2($i);
echo '</pre>';

function my_function2($d)
{
   printf("%4d ==> %0.6f\n", $d, deg2rad($d)) ;
}
   0 ==> 0.000000
  15 ==> 0.261799
  30 ==> 0.523599
  45 ==> 0.785398
  60 ==> 1.047198
  75 ==> 1.308997
  90 ==> 1.570796
 105 ==> 1.832596
 120 ==> 2.094395
 135 ==> 2.356194
 150 ==> 2.617994
 165 ==> 2.879793
 180 ==> 3.141593

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.