NEW
Font size
WorksheetsPHP BASIC
Total questions: 10
Worksheet time: 10mins
Insert the missing part of the code below to output "Hello World".
echo and print
System.out.println
println
cout
Write the correct opening tag and close tag for PHP scripts.
{}
<?php ?>
<>
<? ?>
Statements in PHP have to end with a special character, which one?
.
,
:
;
Create a variable in php assign with the
String
const
let
$
Get the length of the string "Hello World!".
Leng
substring
strlen
len
Use the correct function to output the number of items in an array.
$fruits = array("Apple", "Banana", "Orange");
echo $fruits[0]
echo $fruits["Apple"]
echo count($fruits)
echo $fruits[0][1]
Write a correct syntax to include a file named "footer.php".
include ("footer.php");
import("footer.php");
required("footer.php");
export("footer.php");
Assume we have a file named "webdict.txt", write the correct syntax to open and read the file content.
readfile("webdict.txt")
openfile("webdict.txt")
writefile("webdict.txt")
modifyfile("webdict.txt")
Create a cookie named "username".
setcookie = ("username", "John", time() + (86400 * 30), "/");
setcookie("username", "John", time() + (86400 * 30), "/");
session("username", "John", time() + (86400 * 30), "/");
setsession("username", "John", time() + (86400 * 30), "/");
Create a session variable named "favcolor".
$session["favcolor"] = "green";
$_SESSION["favcolor"] = "green";
$_SESSION["favcolor"] ["green"];
$SESSION["favcolor"] ="green";
