Week 9

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Still alive ?

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Errors have been made

  • Asking too many things
  • Test and practical work simplified
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Fail fast, fail cheap

Or Learn fast, learn cheap

Who knows what it is ?

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Quiz

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Situation

An improvisation troupe asked me to create a showcase website with information about the troupe and a way of contacting them. Should I use PHP to implement it ?

  • A) YES
  • B) NO
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

B) NO

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

HTML form

What is the correct URL resulting from a GET request sent from an HTML form with the following attributes ?

<form action="https://web.com/" method="GET">
		<input type="text" name="name" value="John">
		<input type="text" name="age" value="42">
		<input type="submit" value="Submit">
</form>
  • A) https://web.com/?name=John&age=42
  • B) https://web.com/?name=John&age=42&submit=Submit
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

A) https://web.com/?name=John&age=42

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Question

Which of the following is a URL resulting from a GET request ?

  • A) https://web.com/
  • C) localhost:8000/?name=John&age=42
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

BOTH https://web.com/ and localhost:8000/?name=John&age=42

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Question

Which of the following the right definition of PHP ?
  • A) PHP is a programming language that can be used to create dynamic web pages, needs compilation and is executed on the server side.
  • B) PHP is a programming language that can be used to create dynamic web pages, needs compilation and is executed on the client side.
  • C) PHP is a programming language that can be used to create dynamic web pages, is an interpreted language and is executed on the server side.
  • D) PHP is a programming language that can be used to create static web pages, is an interpreted language and is executed on the client side.
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

C) PHP is a programming language that can be used to create dynamic web pages, is an interpreted language and is executed on the server side.

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Question

What does this code do ?

<?php
    $a = "5 apples";
    $b = 3;

    $result = $a + $b;

    echo $result;
?>
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license
  • A) Outputs "8"
  • B) Outputs "5 apples3"
  • C) Generates a warning or error
  • D) Outputs "53"
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

C) Generates a warning or error

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Question

What does this code do ?

<?php
    $x = "10";
    $y = "20";

    $result = $x + $y;

    echo $result;
?>
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license
  • A) Outputs "30"
  • B) Outputs "1020"
  • C) Generates a warning or error
  • D) Outputs "10"
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

A) Outputs "30"

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Which of the following are good practices for maintaining code integrity?

  • A) Use a version control system, pull requests and code reviews.
  • B) Listening to the client and doing what they want.
  • C) Having more time talking about the code than writing it.
  • D) Use Linter, Formatter and tests.
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

A and D

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Question

While using a package manager like Composer, what is the purpose of the `composer.lock` file ?
  • A) The composer.lock file stores the Composer configuration settings for a project.
  • B) It is a backup file that contains the previous versions of the installed packages.
  • C) composer.lock is used to lock the entire project, preventing any changes to the codebase or dependencies.
  • D) The composer.lock file stores the exact version of every package that is installed in the project.
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

D) The composer.lock file stores the exact version of every package that is installed in the project.

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

Question

What should you commit ?

  • A) The vendor folder, and the composer.json file.
  • B) The composer.json and composer.lock files.
  • C) The vendor folder, and the composer.lock file.
  • D) The vendor folder, and the composer.json and composer.lock files.
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

B) The composer.json and composer.lock files.

HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

And now ?

  • Practical work
  • Keeping up with the other course so you do not have a mental breakdown
  • I'm here if you want to go deeper in PHP
HEIG-VD - WEB Course 2023-2024 - AGPL-3.0 license

This is a way to make link and shortcut in the code

This comment will center everything on the page