⊗ppPmBsAON 46 of 447 menu

Nuances of Working with the Assignment Operation in PHP

Now we will analyze some nuances of working with the assignment operation.

Look at the following example:

<?php $num = 1; // declare the variable $num and assign the value 1 to it $num = $num + 2; // assign to $num itself plus 2 echo $num; // will output 3 ?>

Without running the code, determine what will be displayed on the screen:

<?php $num = 1; $num = $num + 1; $num = $num + 1; echo $num; ?>

Without running the code, determine what will be displayed on the screen:

<?php $num = 1; $num = $num + 2; $num = $num + 3; echo $num; ?>
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline