That won't work unless you're only using two (or fixed digit numbers if you change 100 to 10 or 1000 etc.).
You posted a very limited sample size; how am I suppose to extrapolate what you need to do from that? I made a logical assumption; I would have had to assume something regardless, given the level of details you provided.
E.g.
a = 12
b = 189
(12 * 100) + 189 = 1389
12 . 189 = 12189
If you checked "b" for its value (greater or less than 100, for instance), you could know whether to multiply "a" by 100 or by 1000. This algorithm could be expanded on (and generalized, given a bit of thought) to allow you to "concatenate" any number of numeric values.
Of course, if you wanted to concatenate "12" with the letter "b" (for "12b"), then you have to get into string concatenation; but you haven't said that's what you need...
Are you looking for a general string concatenation routine, or only concatenation of numeric values? You could, for instance, convert (cast) the values into strings, concatenate the values, then cast that value back to a numeric. Of course, both this method and the method I described previously above would run into variable sizing issues, so you could only create so large of a number.
If you don't need to use the concatenated number for further calculations, though, it could remain as a string.
Easy in PHP because it's a variable type language. So the . operator uses each value as a string and then appends one to the other. If that new value is used in code as a number, it converts it.
What you mean is PHP is a "non-typed" language; which isn't completely true - its similar to VB6 where all variables are, by default, these weird constructs called "variants" - as soon as you (or PHP) decides to cast that long string of numbers into an actual type for calculations, things probably get wonky (though to be honest, I've never tried this myself; I've never had the need to). Values might be truncated, or errors thrown - one of the two.

[edit]Oops - sorry, Eight; just saw your reply - if you keep working at what you are doing, though, you can come up with a generalized function/method to handle any number of values. It would probably be a recursive algorithm, but I don't think you would necessarily need special math functions (floor or log); I think you could get by with simple arithmetic, and maybe some decision tree logic. :)[/edit]