I faced with some issue to increase the vale of the string, for example:
$string = "someString_1";
I need value somestring_2. Ofcourse I can use something like this.
But was trying to find another way and as a result I found that it will be enought make $string++ in my case;
$string++;
echo $string; //someString_2
It was great that I have only 1 string of code. BUT:
Queston, is this correct way, or is there more better variants?(in condition that my string allways will have integer at the end)
And why it does not work when integer at the first position. For example if we make:
echo '1string' + '2string';// result 3. This is how PHP work with string when we want make some mathemetic operations
$string = "someString_9"; $string++; echo $string;someString_09, what will happen when you reachsomeString_99.... string incrementing is extremely useful in the right circumstances, but does have its limitations