Edit report at https://bugs.php.net/bug.php?id=63632&edit=1
ID: 63632 Comment by: inefedor at gmail dot com Reported by: bensor987 at neuf dot fr Summary: $var =. 'val'; Status: Open Type: Feature/Change Request Package: Variables related Operating System: All PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I think the main concern with "preconcatenation" is 100% chance of reallocation of memory. If it will be part of syntax - people would use it often, but it's something you should avoid using of. Try to execute this code: $c = 10000; $b = 200; $t1 = microtime(1); $str1 = ""; for ($i = 0; $i < $c; ++$i) { $str1 = str_repeat(mt_rand(0, 9), $b) . "\n" . $str1; } $t1 = microtime(1) - $t1; $t2 = microtime(1); $strArr = array(); for ($i = 0; $i < $c; ++$i) { $strArr[] = str_repeat(mt_rand(0, 9), $b); } $strArr = implode("\n", array_reverse($strArr)); $t2 = microtime(1) - $t2; echo $t1 . "\n" . $t2 . "\n"; First part of this code does exactly the same as second part, but it's 300 times slower. Previous Comments: ------------------------------------------------------------------------ [2012-11-28 11:07:15] bensor987 at neuf dot fr Erm. Maybe we could use another syntax for this suggestion ? ------------------------------------------------------------------------ [2012-11-28 10:57:51] inefedor at gmail dot com Collides with: $asd =.4; echo $asd; Output should be: 0.4 ------------------------------------------------------------------------ [2012-11-28 09:57:01] bensor987 at neuf dot fr Description: ------------ Why not add "$var =. 'val';" syntax ? It would concatenate 'val' before $var. Actually, you have to do this <?php $var = 'val' . $var; ?> My suggestion make the code shorter : <?php $var =. 'val'; ?> Test script: --------------- <?php $a = "Hello "; $b = $a . "World!"; // now $b contains "Hello World!" $c = "World! " . $a; // now $c contains "World! Hello " $a = $b = "Hello "; $a .= "World!"; // now $a contains "Hello World!" $b =. "World! "; // now $b contains "World! Hello " ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63632&edit=1