PHP

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

How to include files in php?

Include "footer.php" by placing within the HTML the line: <?php include 'footer.php'; ?>

Are function names case sensitive?

No (foo(...) == Foo(...) == FoO(...))

Can we call functions in PHP before declaring them?

No. Functions must be defined before they can be called.

What are PHP Sessions?

To store and display information about a user, determine which user-groups a person belongs to, or utilize permissions on your website. Same result as using cookies but without storing information on the user's computer (saved on the web server).

How to send client information?

Using a form: <form method="post" action="file.php" id="frmid"> - Method specifies how the data will be sent - Action specifies the file to go to - id gives the form a unique name

What is the purpose of a variable declared "static"?

Variable declared "static" do not disappear when a function is completed

How to get the date in PHP?

date("yyyy/mm/d")

What is used in php? elif or else if?

else if

How to iterate through a key/value arrat?

foreach($row as $key=>$value) {}

How are function headers defined?

function functionName($arg_1, $arg_2, ..., $arg_n) No return type is specified.

Mention super global variable examples:

$_POST, $_GET, $_SERVER, $_COOKIE, $_SESSION, $_ENV

How to initialize MySQL and make a query?

$link = mysql_connect($host, $user, $password); mysql_select_db($database); $query = "SELECT * FROM $table WHERE id = $id;"; $result = mysql_query($query);

What is the difference between post and get?

- Post method sends all contents of a form with -basically hidden headers - Get method sends all form input in the URL requested using name=value pairs separated by ampersands (&)

Which of the following is true in PHP for rules that must be followed when naming a variable?

- Variable names must begin with a dollar sign ($) - Variable names may contain uppercase and lowercase letters, numbers, or underscores (_). The first character after the dollar sign must be a letter or underscore. - Variable names cannot contain spaces. - Variable names are case sensitive.

What is PHP_SELF?

An index variable that returns the current script being executed, including its name and path.

How to create a constant in PHP?

Constants don't begin with $, but start with a letter or underscore (_) followed by letters, numbers or underscores. Constants use all upper case letters. Use define() to create a constant.

How to assign a variable by reference in PHP?

Same as with C: $bar = &$foo


Set pelajaran terkait

NUIP energy balance and with control

View Set

Week 1- Introduction and Concept of Substance Use Disorders

View Set