Reply to Re: [PHP] numbers as strings

Your name:

Reply:


Posted by Jon Aston on 05/10/05 22:59

Normally it truncates the leading zeros if there are any. I will try your
method when I get a moment. got switched on project.


"Rory Browne" <rory.browne@gmail.com> wrote in message
news:fa07888a05050916083001056b@mail.gmail.com...
For the most part you can simply treat them as strings. What is
happening that shouldn't be happening, or what should be happening,
but isn't?

> let us say
> $a = 1;
> $b = 2;
> $c = 0;

$str_a = (string)$a;
$str_b = "$b"


> I would like to be able to
> $str = $c.$a.$b;
Does that not work? What happens when you do that? Personally I'd use
$str = "$c$a$b";


> to result with
> $str = 012;
>
I tried:
[rory@mybox ~]$ cat > test.php
<?php

$a = 1; $b = 2; $c = 0;

$str = $c . $a . $b;

echo $str;

?>
[rory@mybox ~]$ php -q test.php
012



> is there something that I have missed or I guess the question should be
what
> did I miss
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация