Strict Standards: Non-static method nggallery::get_option() should not be called statically in /home/mchedlishvili.com/mike/WWW/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 10

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Strict Standards: Only variables should be assigned by reference in /home/mchedlishvili.com/mike/WWW/wp-includes/post.php on line 173

Usage:

echo leading_zeros(’654321′, 10);

Result:

0000654321

Notes: You must use either single or double quotes in the first argument of the function call. Failure to do so will result in an undesirable number format. If your output is displayed in an exponential format, you probably left out your quotes. Additionally, any variable used in the first argument must contain a string and not a number.

For example,

$value = 1234567890987654321;

Doesn’t work but,

$value = ‘1234567890987654321′;

Does work!

  1.  
  2. function leading_zeros($value, $places) {
  3.  
  4. if (is_numeric($value))
  5.  {
  6.  for ($x = 1; $x <= $places; $x++)
  7.   {
  8.   $ceiling = pow(10, $x);
  9.   if ($value < $ceiling)
  10.    {
  11.    $zeros = $places - $x;
  12.    for ($y = 1; $y <= $zeros; $y++) $leading .= "0";
  13.    $x = $places + 1;
  14.    }
  15.   }
  16.  $output = $leading.$value;
  17.  } else $output = $value;
  18. return $output;
  19. }

C этой записью сегодня также читали: