Az $x változó int és stringként akarja használni use case stimmel, csak a leírásban azt írja, hogy explode, +-al prefixeli, és utána a PHP már számként kezeli, valahogy nekem nem stimmel. A stringbe más írás is stimmel.
<?php
$start = microtime(true);
$int = 123456;
for($j = 0; $j < 1000; $j++) {
for($i = 0; $i < 10000; $i++) {
$string = "$int";
}
}
echo (microtime(true) - $start), PHP_EOL;
$start = microtime(true);
for($j = 0; $j < 1000; $j++) {
for($i = 0; $i < 10000; $i++) {
$string = (string)$int;
}
}
echo (microtime(true) - $start), PHP_EOL;Nálam átlag olyan 10+%-al lassabb az idézőjeles.
BlackY