Interview Questions → PHP → PHP Questionnaire I
PHP Questionnaire I
<html>
<head>
<title> </title>
</head>
<body>
<?php
print("Test 1") ;
echo "test2", "test3"
?>
</body>
</html>
<html>
<head>
<title> </title>
</head>
<body>
<?php
$output = print("Test 1") ;
//$output = echo "test2", "test3"
?>
</body>
</html>
<html>
<head>
<title> </title>
</head>
<body>
<?php
$string = "123.456";
print_r(preg_split("/\./", $string));
?>
</body>
</html>
<html>
<head>
<title> </title>
</head>
<body>
<?php
$string = "123.456";
print_r(explode(".", $string));
?>
</body>
</html>
<html>
<head>
<title></title>
</head>
<body>
<?php
$numeric_var = 10;
$string_var= "10";
if($numeric_var == $string_var)
{
echo "equal";
}
else
{
echo "not equal";
}
?>
</body>
</html>
<?php
$numeric_var = 10;
$string_var= "10";
if($numeric_var == $string_var)
{
echo "equal";
}
else
{
echo "not equal";
}
?>
<?php
$numeric_var = 10;
$string_var= "10";
if($numeric_var === $string_var)
{
echo "equal";
}
else
{
echo "not equal";
}
?>
<html>
<body>
<div class="leftmenu">
<?php require 'menu1.php'; ?>
</div>
<h1>Welcome to my home page.</h1>
<p>Some text.</p>
</body>
</html>
<html>
<body>
<div class="leftmenu">
<?php include 'menu1.php'; ?>
</div>
<h1>Welcome to my home page.</h1>
<p>Some text.</p>
</body>
</html>
<html>
<body>
<?php
$message = "you";
$you= "Me";
echo $message;
echo $$message;
?>
</body>
</html>
<html>
<body>
<?= "Hi"?>
</body>
</html>
<?php
echo 23;
echo 0x23;
?>