php - Autoincrementing strings -


i'm trying build hierarquical list of categories, this:

1 category   1.1 children   1.2 children       1.2.1 children 

here's code:

$a = "1.1"; echo ++$a; // 2.1  $b = "1.1.1"; echo ++$b; // 1.1.2 

why $a increments 2.1 instead of 1.2 $b?

"1.1" parses float value 1.1, , can tell 1.1 + 1 = 2.1

however, "1.1.1" can't parsed number, treated string. php supports ++ strings in different ways in attempt useful, successful letters (a through z, aa, ab...).


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -