W3Schools PHP Cert Guide

Ace your homework & exams now with Quizwiz!

How many of the following statements are ture for PHP operators?

1

In PHP 5 how many of the following functions are part of the PHP core?

1

How many of the following are true for PHP exception handling?

3

In PhP what is the correct way of including the file firefly.php?

<?php include "firefly.php"; ?>

Which operator is used to check if two values are equal and of same data type?

===

In MySQL what is proper syntax for adding a column to an existing table?

ALTER TABLE table_name ADD column_name datatype

Which operator is used to select values within a range?

BETWEEN

In MySQL what is the proper syntax for creating a unique index on a table?

CREATE UNIQUE INDEX index_name ON table_name (column_name)

In MySQL which keyword is used to return only different values?

DISTINCT

In PHP what is the filter used to validate e-mail address?

FILTER_VALIDATE_EMAIL

A PHP session permanently stores user information on the server

False

In PHP the only way to output text is with echo

False

PHP is an object oriented language?

False

When using the POST method variables are displayed in the URL

False

Which operator is used to search for a specified pattern in a column?

From

What does PHP stand for?

Hypertext Preprocessor

What is the most common type of join?

INNER JOIN

PhP is a _____ typed language

Loosely

Which SQL keyword is used to sort the result-set?

ORDER BY

In MySQL which keyword is used to sort the result

Order By

What can PhP do?

PHP can generate dynamic page content PHP can create, open, read, write, delete, and close files on the server PHP can collect form data PHP can send and receive cookies PHP can add, delete, modify data in your database PHP can be used to control user-access PHP can encrypt data

In MySQL how to return all the records from a table named "Customers" sorted REVERSE alphabetically by "FirstName"?

SELECT * FROM Customers ORDER BY FirstName REV

In MySQL how to return the number of records without a NULL value in the "address" column in a table name "Customers"?

SELECT COUNT (address) FROM Customers

With SQL, how do you select a column named "FirstName" from a table named "Persons"?

SELECT FirstName from Persons

In MySQL what is the syntax for creating an alias for a column?

SELECT columnname AS columnaliasname from tablename

In MySQL what is the proper syntax for extracting data from a database?

Select

With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

Select * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

What does SQL stand for?

Structured Query Language

A MySQL connection in PHP will automatically close when the script ends?

True

In MySQL the AND operator displays a record if ALL conditions listed are true

True

In MySQL the OR operator displays a record if ANY of the conditions listed are true

True

In PHP ID keys in arrays are always assigned automatically?

True

PHP allows you to send emails directly from a script

True

PhP scripts are executed on the server?

True

Php is executed on the server and returned to the browser as html?

True

The NOT NULL constraint enforces a column to not accept null values.

True

in PHP the availability of a constant is always global

True

In PHP the die() and exit() functions do the exact same thing?

Trye

In PHP the setcookie() function must appear BEFORE the <html> tag

Ture

Which SQL statement is used to update data in a database?

UPDATE

In MySQL how to change all the "Lucas" causes to "Whedon" in the "LastName" column in a table named "Customers"?

UPDATE Customers SET LastName = "Whedon" WHERE LastName = "Lucas"

$_REQUEST

Used to collect data after submitting a html form

PHP offers built-in functions to validate user input. What are these functions called?

Validation Functions

Assume that the following URL is sent to the server: http://www.w3school.com/test.php?fname=Wil&lname=Wheaton The PHP file "test.php" contains the following script: <body> Welcome <?php echo $_REQUEST["fname"].$_REQUEST["lname"]; ?> </body> What will the browser display in the body of the document?

Welcome Will Wheaton

Get The Length of an Array

count()

All PHP constants start with $_?

false

In PHP the only way to output is with echo?

false

Include files must have the file extension ".inc"

false

What is the correct way to open the file "time.txt" as readable?

fopen("time.txt", "r");

In PHP a file can be opened with the

fopen() function

What is the correct way to create a function in PHP?

function myfunction()

in PHP a timestamp can be made with the

mktime()

function searches a string for pattern, returning true if the pattern exists, and false otherwise.

preg_match()

php counts number of words in a string

str_word_count()

Get length of a string php

strlen()

In PHP two string values can be put together with the

.operator

In PHP you can get the user's browser capabilities with the

get_browser() function

x += y

x = x + y

All variables in PHP start with which symbol

$

The PHP superglobal variables

$GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION

In PHP which command is used to retrieve a cookie value

$_COOKIE

How do you get information from a form that is submitted using the "get" method?

$_GET[];

Which superglobal variable holds information about headers, paths, and script locations?

$_SERVER

How do you create an array in PHP?

$cars = array("Volvo", "BMW", "Toyota");

in PHP what is the correct way to add 1 to the $count variable?

$count++

Which of the following is NOT a valid variable name in PHP

$sale-per-week

In PHP the logical operator for "and" is

&&

What is a correct way to add a comment in PHP

/* */

PHP line comments

// This is a single-line comment # This is also a single-line comment /* This is a multiple-lines comment block that spans over multiple lines */ // You can also use comments to leave out parts of a code line

Which of the following is true for PHP variables?

A variable must always be declared before being used

Which SQL statement is used to create a table in a database?

Create Table

Which SQL statement is used to delete data from a database?

DELETE

With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?

DELETE FROM Persons WHERE FirstName = 'Peter'

With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

INSERT INTO Persons (LastName) Values ('Olsen')

In MySQL what is the proper syntax for inserting new data in a database?

Insert Into

In MySQL how to insert a new record into a table named "Customers"

Insert into Customers VALUES ("Joss, Whendon")

The PHP syntax is most similar to

Perl and C

The following function function write_text() { $firstname = "Peter"; $lastname = "Griffin"; return $firstname; return $lastname; } Will return;

Peter Griffin

In MySQL how to select all columns from a table named "Customers"?

SELECT * FROM CUSTOMERS

With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

SELECT * FROM Persons ORDER BY Firstname DESC

Which SQL statement is used to return only different values?

SELECT DISTINCT

In MYSQL how to select all te record from a table named Customers where FirstName starts with an a?

Select * FROM Customers WHERE FirstNmae Like a%

In MySQL how to select all the records from a table named "Customers" where FirstName is Peter?

Select * FROM Customers where FirstName = "Peter"

In mysql how to select all the record from a table named customers where firstname is peter and Lastname is Jackson?

Select * From customers where FirstName = "Peter" AND LastName = "Jackson"

In MySQL how to return the number of records in a table named "Customers"?

Select Count * From Customers

PHP can be run on Microsoft Windows IIS(Internet Information Server)

True

When to usee while loop

While loops are best used when you don't know exactly how many times you may have to loop through a condition - if you know exactly how many times you want to test a condition (e.g. 10), then you'd use a for loop instead.

in php for strings

You can use single or double quotes:

in PHP a constant is set by the

define() function

Differences between echo and print?

echo is faster; no return type print has return value of 1; can only take 1 arguement

more info about $_server

https://www.w3schools.com/php/php_superglobals.asp

In PHP the default error reporting can be changed by setting the

set_error_handler() function

How do you create a cookie in PHP?

setcookie()

Different sort functions for arrays sort() rsort() asort() ksort() arsort() krsort()

sort() - sort arrays in ascending order rsort() - sort arrays in descending order asort() - sort associative arrays in ascending order, according to the value ksort() - sort associative arrays in ascending order, according to the key arsort() - sort associative arrays in descending order, according to the value krsort() - sort associative arrays in descending order, according to the keyasort()

search for specific text in a string

strpos()

reverse a string

strrev()

$_SERVER

super global variable which holds information about headers, paths, and script locations.

To create a constant

use the define() function; define(name, value, case-insensitive) default is false

$GLOBALS

used to access global variables from anywhere in the PHP script


Related study sets

Модуль філософія

View Set

MS: Module 8: Neuromuscular: Exam

View Set

AP Psychology Disorders and Treatments

View Set

CHAPTER-41-ETHICS-(17 QUESTIONS)

View Set

Quiz 1 mental social and emotional health

View Set

Spanish IIIA: Lección 8 Practice Exam (conditional, past subjunctive, vocabulary, and si clauses)

View Set