What will be the output of the following code?<?phpecho ord ("Hello World");?>0.5 Marks103209106104
Question
What will be the output of the following code?
<?php
echo ord("Hello World");
?>
0.5 Marks
103209106104
Solution
To determine the output of the given PHP code, let’s analyze the code step-by-step:
Step 1: Understanding the ord()
function
The ord()
function in PHP returns the ASCII value of the first character of a string.
Step 2: Analyzing the string input
The string provided to the ord()
function is "Hello World"
. Since this function examines only the first character, we will consider the first character of the string, which is "H"
.
Step 3: Finding the ASCII value
The ASCII value of the character "H"
is 72
.
Step 4: Reviewing the rest of the code
The code being executed only contains the ord("Hello World")
function call followed by echo
, which will output the result of that function.
Final Answer
Therefore, the output of the code <?php echo ord("Hello World"); ?>
will be:
72
Similar Questions
What will be the output of the following PHP code?< ?php$hello = "Hello World";$bye = "Bye";echo $hello;"$bye";?>
What will be the output of the following PHP code?1.0 MarksNo OutputAll of the above8 === 81
What will be the output of the following PHP code ?< ?php$on_e = 1;$tw_o = 2;$thre_e = 3;$fou_r = 4;echo "$on_e / $tw_o + $thre_e / $fou_r" ;?>
What will be the output of the following PHP code?< ?phpecho $red ;?>0NothingTrueError
What will be the output of the following PHP code ?< ?phpone = 1;two = 2;three = 3;four = 4;echo "one / two + three / four";?>
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.