PHP Assign Multiple Variables in One Line

<?php 

$var1 = $var2 = $var3 = '';

?>

When you need to assign or declare mutliple variables at once, this can be accomplished with one line. So instead of making your code look cluttered like so:

$var1 = '';
$var2 = '';
$var3 = '';

To perform the exact same functionality in one line, you can write it like so:

$var1 = $var2 = $var3 = '';

Easy peasy, right? Hope that helps :)

BETA Snippet explanation automatically generated by OpenAI:

No explanation generated yet.

Snippet By Dev Dojo

·

Created June 12th, 2021

·

Report Snippet