Which of the below statements is equivalent to $add += $add ?
A.$add = $add
B.$add = $add +$add
C.$add = $add + 1
D.$add = $add + $add + 1
Answers
Answered by
13
✔✔✔✔
⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵ ıllıllıllıllıllıllııllıllıllıllıllıllııllıllıllıllıllıllı
_______________________
↪ -
$add = $add+$add
because $add += $add
doubles the value of $add and so does $add = $add+$add if initially $add = $add = $add + 1
C.$add = $add + 1✔✔
_______________________ ıllıllıllıllıllıllııllıllıllıllıllıllııllıllıllıllıllıllı
Answer - By Choudhary21
⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵ ıllıllıllıllıllıllııllıllıllıllıllıllııllıllıllıllıllıllı
_______________________
↪ -
$add = $add+$add
because $add += $add
doubles the value of $add and so does $add = $add+$add if initially $add = $add = $add + 1
C.$add = $add + 1✔✔
_______________________ ıllıllıllıllıllıllııllıllıllıllıllıllııllıllıllıllıllıllı
Answer - By Choudhary21
Answered by
1
Option b is the correct answer. Here $add = $add +$add is equivalent to $add += $add
- += is an addition assignment operator.
- += operator adds up or concatenate the value or string respectively of the right hand operand to assign a new value or string within the variable.
- Here, if $add stores numerical value then $add += $add is equivalent to $add = $add +$add or $add = $add + 1 (i.e, option b or c both).
- If $add stores string then $add += $add is equivalent to $add = $add +$add (only option b).
- So, as a whole, option b is much more appropriate in this case.
##SPJ3
Similar questions
Science,
7 months ago
Computer Science,
1 year ago
World Languages,
1 year ago
Chemistry,
1 year ago