Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- מבחן PHP דור מורסיאנו ת.ז:204447270 מספר נבחן:010
- שאלה מספר 1 סעיף א':
- <?php
- $Text="hello world";
- $x=10;
- switch($x){//פה היה חסר סימן דולר
- case 5: echo "$Text $x";
- break;
- case 6: echo "$Text $x";
- case 10:
- echo "$Text $x";
- break;
- }
- ?>
- שאלה 1 סעיף ב:
- <?php
- $x="jeffrey";//פה לא היה הכרזה למשתנה ותוכן שלו
- switch($x)
- {
- case "jeffrey":
- echo "my name is jeffrey";//פה במקום להדפיס משתנה שיניתי את תוכן הפלט
- case "name":
- break;
- }
- ?>
- שאלה 1 סעיף ג':
- <?php
- function printer($age){
- for($index=4;$index>=0;$index--){//הפכתי את הריצה של הלולאה
- switch($index){
- case 0:
- echo $index+ $age;
- break;
- case 1:
- echo $index +$age;
- break;
- case 2:
- echo $index +$age;
- break;
- case 3:
- echo $index +$age;//בכל הקייסים היה חסר דולר במשתנה age
- break;
- }
- }
- }
- printer(1);//שיניתי את הערך ההתחלתי בקריאה לפונקציה
- ?>
- שאלה 2 סעיף א:
- <?php
- $age=27;
- $name="dor ";
- function printname($age,$name){
- echo $name; echo $age;
- }
- printname($age,$name);
- ?>
- שאלה 2 סעיף ב:
- <?php
- $namesArr=array();
- $agesArr=array();
- for($i=0;$i<5;$i++){
- $nameArr[$i]="dor ";
- $agesArr[$i]="27 ";
- echo $nameArr[$i];
- echo $agesArr[$i];
- }
- ?>
- שאלה 2 סעיף ג:
- <?php
- function printNames($arr1,$arr2){
- echo $arr1; echo $arr2;
- }
- $arr1=array("dani "," yossi "," nati ");
- $arr2=array(25,28,29);
- $index=0;
- while($index<3){
- printNames($arr1[$index],$arr2[$index]);
- $index++;
- }
- ?>
- שאלה 3 סעיף א:
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>submit</title>
- </head>
- <body>
- <form action="index.php" method="post">
- <input type="text" name="userName" placeholder="enter username">
- <input type="password" name="password" placeholder="enter password">
- <input type="submit" name="submit">
- </form>
- </body>
- </html>
- שאלה 3 סעיף ב':
- <?php
- echo $_POST['userName'];
- echo $_POST['password'];
- ?>
- שאלה 4:
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>example</title>
- </head>
- <body>
- <?php include 'example.php';?>
- </body>
- </html>
- קובץ חיצוני
- <?php
- echo "good night";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement