PHP Flashcards

1
Q

Acronym for PHP

A

PHP Hypertext Preprocessor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Original acronym for PhP

A

Personal Home Page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Basic output statements in Php

A

Echo and print

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Variable names are case sensitive.

YES or NO ?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

$_GET

A

contains value of input being transported through GET method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

$_ENV

A

contains server environment variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

String Concatenation

A

$string3 = $string1 . $string2;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Function ‘filetype’

A
checks if it’s a file or directory
echo "/etc/passwd is a " . filetype('/etc/passwd');
// is a file
echo "/etc is a " . filetype('/etc');   // is a dir
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Function ‘gettype’

A
checks the type of variable
$var1 = 5;             // integer
echo gettype($var1);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

‘header’ function

A

used to redirect browser to another location

header(“Location: http://ict.senecacollege.com”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

$_SERVER[“REMOTE_ADDR”]
$_SERVER[“SERVER_NAME”]
$_SERVER[“SERVER_ADDR”]

A

User’s IP address
Server’s name:
Server’s address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

strlen() function

A

to return the length of a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

strpos() function

A

to search for a character/text within a string

  • If a match is found, this function will return the character position of the first match.
  • If no match is found, it will return FALSE.

echo strpos(“I love Linux”,” Linux”); //returns 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Date functions

A
// to show date in numbers eg. 21  11 10 
echo date("d m y");
// to show date in numbers with hyphen separators eg.21-11-10 
echo date("d-m-y");
// to show date in words  eg. Sun Nov 2010
echo date("D M Y");
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Time functions

A
//time (12 hr clock) separate by colon using a date function
echo date("h:i:s");
//time (24 hr clock) separated by colon using a date function
echo date("H:i:s");
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

function ‘decbin’

A

converts decimal to binary

17
Q

function ‘bindec’

A

converts binary to decimal

18
Q

Associative Arrays

A

$ages=array(“Peter”=>32, “Jim”=>30, “Ken”=>34);

echo “Peter is “ . $ages[‘Peter’]. “years old”;

19
Q

Difference between: include() and require()

A
program will continue executing if the filename you pass to include() does not exist,
while require() will stop executing if the filename you pass does not exist