Computer Science, asked by salwagkq8852, 1 year ago

what is the output of the below PHP code: list1 = [123, 'Lee'] print (list1*2)

Answers

Answered by pinky135
2
The output is ERROR because Lee is a character and 2 is a number.
Character doesn't multiple with number so the answer will be error

hasnatmirza111p06f0z: you are right but you are wrong
Answered by hasnatmirza111p06f0z
1
first off all you are crating variable list1 when we create variable in php then we have to define variable with $ or _.second your multiplying string * integer is not possible till you not define that a string is a integer.
fine this code will be:
<?php
$list1 = 123;
    print (or) echo ($list1*2)
?>
output:246
Similar questions