Midterm Study Flashcards
What does PHP stand for?
Php hypertext protocol
Is php statically or dynamically typed?
Php is dynamically types because any variable can contain any value
Is php strongly or weakly typed,
Php is weakly typed because a value of any type can be used in expressions. Eg. 78 > “PHP” does not cause an error, first it tries to convert the string into a number, of it can’t then the string gets a value of 0 and then it is compared.
What type of language is PHP?
Php is an imperative server side scripting language. This means that the code runs on the server not on the client, the scripts are run and the results are sent to the client. Being imperative means php does not need a main class to function, it can stand alone and gets executed sequentially.
What does imperative mean?
Imperative means that the language does not need a main method to run, it can stand alone, be embedded and gets executed in a sequential order
Can you see PHP in the browsers inspection tool?
No PhP is server side and is not accessible by the client.
When do you need to add .php to the end of your file?
When there is any php whatsoever in the file.
What is the difference between single and double quotes in php?
Single quotes are literal strings where double quotes are executed, if you have a variable in doh or quotes it will call the variable, single quotes will not
How do you create a function in PHP?
Function functionName ($a, $b) { code; }
Is PHP interpreted or compiled?
Interpreted in real time in the browser
What is the symbol used for concatenation in PHP?
. Not +
Reserved words, functions, and class names are; case sensitive or case insensitive?
Case insensitive, but variable names are case sensitive
What is an associative array in PHP?
Like a dictionary in python, it is an array of key and value pairs.
What are the two syntactically correct ways to create associative arrays?
$user = []; $user[“studentid”] = “9265743”; $user[“age”] = 22;
OR
$user = [“studentid”=>”9036538”, “age”=>”22”];
What are the 3 syntactically correct ways to echo associative arrays?
echo “Your Userid: {$user[“studentid”]}”;
echo “Your Userid: $user[studentid]”;
echo “Your Userid: {$user[$a.$b]}”;