Sei sulla pagina 1di 4

Name: Bernadette Santos

1. Create a personal information using the numeric array and display/take screenshot of
the output of the code written using the format below:

<?php
$personalinfo[0] = "replace with your first name";
$personalinfo[1] = "replace with your middle name";
$personalinfo[2] = "replace with your last name ";
$personalinfo[3] = "replace with your course";
$personalinfo[4] = "replace with your mother’s maiden name";

foreach( $personalinfo as $value ) {


echo "$value <br />";
}
?>

Your final code:


<?php
$personalinfo[0] = "Bernadette";
$personalinfo[1] = "Escribano";
$personalinfo[2] = "Santos";
$personalinfo[3] = "BSCS";
$personalinfo[4] = "Marybeth Macapas Escribano";

foreach( $personalinfo as $value ) {


echo "$value <br />";
}
?>

Screenshot:
2. Create a personal information using the associative array and display/take
screenshot of the output of the code written using the format below:

<?php
$personalinfo['first'] = "replace with your first name";
$personalinfo['middle'] = "replace with your middle name";
$personalinfo['last'] = "replace with your last name";

echo "My First name is ". $personalinfo['first'] . "<br />";


echo "My Middle name is ". $personalinfo['middle']. "<br />";
echo "My Last name is ". $personalinfo['last']. "<br />";
?>

Your final code:


<?php
$personalinfo['first'] = "Bernadette";
$personalinfo['middle'] = "Escribano";
$personalinfo['last'] = "Santos";

echo "My First name is ". $personalinfo['first'] . "<br />";


echo "My Middle name is ". $personalinfo['middle']. "<br />";
echo "My Last name is ". $personalinfo['last']. "<br />";
?>

Screenshot:
3. Create a personal information using the Multidimensional array and display/take
screenshot of the output of the code written using the format below:

<?php
$personalinfo = array(
array("first"=>"replace with your first name",
"middle"=>"replace with your middle name",
"last"=>"replace with your last name"),
array(
"first"=>"replace with your father’s first name",
"middle"=>"replace with your father’s middle name",
"last"=>"replace with your father’s last name"),
array(
"first"=>"replace with your mother’s first name ",
"middle"=>"replace with your mother’s middle name ",
"last"=>"replace with your mother’s last name "),
);
echo "My name is ".$personalinfo[0]["first"]."
".$personalinfo[0]["middle"]." ".$personalinfo[0]["last"]."<br />";
echo "My father’s name is ".$personalinfo[2]["first"]."
".$personalinfo[2]["middle"]." ".$personalinfo[2]["last"]."<br />";
echo "My mother's name is ".$personalinfo[1]["first"]."
".$personalinfo[1]["middle"]." ".$personalinfo[1]["last"]."<br />";

?>

Your final code:


<?php
$personalinfo = array(
array("first"=>"Bernadette",
"middle"=>"Escribano",
"last"=>"Santos"),
array(
"first"=>"Bernardino",
"middle"=>"Loberiano",
"last"=>"Santos"),
array(
"first"=>"Marybeth",
"middle"=>"Escribano",
"last"=>"Santos"),
);
echo "My name is ".$personalinfo[0]["first"]."
".$personalinfo[0]["middle"]." ".$personalinfo[0]["last"]."<br />";
echo "My father's name is ".$personalinfo[1]["first"]."
".$personalinfo[1]["middle"]." ".$personalinfo[1]["last"]."<br />";
echo "My mother's name is ".$personalinfo[2]["first"]."
".$personalinfo[2]["middle"]." ".$personalinfo[2]["last"]."<br />";

?>
Screenshot:

Potrebbero piacerti anche