I know this isn't the most interesting tip ever, but it saves lines in your code.
If you've ever wanted to set different variables to the same value as each other, you can do it in one line instead of using multiple lines.
Instead of doing:
You can just easily do:
Like I said, it's not the biggest help ever, but it saves line in your code.
To test speed in processing time, I wrote this code:
There isn't a huge difference in time, but it does save time when you actually write the code.
Anyway, hope it somehow helps you.
- Mark
If you've ever wanted to set different variables to the same value as each other, you can do it in one line instead of using multiple lines.
Instead of doing:
PHP:
<?php
$var1 = "mark";
$var2 = "mark";
$var3 = "mark";
?>
You can just easily do:
PHP:
<?php
$var1 = $var2 = $var3 = "mark";
?>
Like I said, it's not the biggest help ever, but it saves line in your code.
To test speed in processing time, I wrote this code:
PHP:
<?php
$start = microtime(true);
$var1 = $var2 = $var3 = "mark";
echo microtime(true) - $start;
?>
There isn't a huge difference in time, but it does save time when you actually write the code.
Anyway, hope it somehow helps you.
- Mark