M2 Flashcards
What is LAMP?
Linux
Apache
MySQL
PHP (Perl or Python)
Called a LAMP Stack, there are other versions of stacks such as WAMP ( w=windows) or MERN(mongodb express react node)
LAMP is one of the most originals
What is an IP address?
Internet protocol address - rules to determine addresses
What is DNS?
Domain name system
Turns a user-friendly domain name like bbc.co.uk into an IP address.
What is a URL?
Uniform resource locator
A reference that is unique to each resource on the web.
http://www.bbc.co.uk/football
It could be the address of a webpage, or a CSS file, or an image file.
What is HTTP?
HTTP
Hypertext Transfer Protocol
Allows HTML documents to be requested and transmitted between browsers and web servers via the internet.
What is a web server?
A computer that stores web server software and a website’s component files (for example, HTML documents, images, CSS stylesheets, and JavaScript files).
Software that includes several parts to control how web users access hosted files. At the very least it understands URLs (web addresses) and HTTP (the protocol browsers use to view webpages).
So the term “web server” can refer to either hardware or software, or both of them working together.
What is static content?
Any content that can be delivered to an end user without having to be generated, modified, or processed. Such as images, audio, video etc
The server delivers the same file to each user.
What is dynamic content?
Any content that must be generated, modified, or processed before being delivered to a user. For example, IMDB and different people looking for different films.
One user receives different content than another user.
Describe the HTTP request response cycle?
HTTP Response cycle - browser to web server with a HTTP Request then either back to browser if static or onto PHP , PHP willo load the file and builds the webpage to send back to web server that sends it back to the browser in a HTTP Response
What is docker and why do we use it?
Docker is a containerized virtual environment that makes it easy to develop, maintain, and deploy apps and services
It replicates the live server as closely as possible for consistency, so we can test our stuff before deploying it to the server.
This creates a standard environment for all developers. Each developer has all the same versions in the LAMP stack as every other developer and the live server.
What is an IDE AND why do we use them?
Integrated development environment
It knows the development language
can spot syntax errors
can make autocomplete suggestions
It has built-in tools for many tasks such as testing, accessing database, etc.
What is a variable?
A box to store data
What is a constant?
A box that never changes its contents, i.e its value is fixed.
What is a data type?
A data type is a classification that specifies what type of value a variable can have and what type of operations (mathematical, relational, logical, etc) can be applied to it without causing an error.
What are the 3 data types in PHP?
Scalar data types scale is something you can count
i.e string, integer, float, boolean
Compound or complex data types
i.e array, objects
Special data types
i.e null
Difference between static and dynamic typing?
Static vs. Dynamic defines how a language expects you to declare data types. Static typed languages require explicit definition of a data type when they create a piece of data (e.g. variable, parameter, return value). Dynamic languages are the opposite and can infer, or at least try to guess, the type that we’re using.
Difference between strong and weakly typed?
Strong vs. Weak defines how flexibly a language allows operations between data types. For example, strongly typed languages will not allow you to add a float to an integer, without you converting it first, even though they are both numbers. On the other hand, a weak language will try its best to accomodate what the programmer is asking and perform these operations
What is type juggling?
When an expression contains variables of different types, PHP will first convert their values to a common, comparable type.
What is the comparison operator?
== compares the values i.e === compares the data type as well
What is the ternary operator?
The ternary operator is used to shorten if/else structures.
The ternary operator is used to shorten if/else structures.
condition ? value if true : value if false;
What is the null coallescing operator?
The null coalescing operator returns its first (i.e. left) operand if it exists and is not null; otherwise, it returns its second (i.e. right) operand.
$val1 = $undefined ?? ‘fallback(1)’;
What is an array?
An array stores multiple values in one single variable:
can be indexed or associative
What is a function?
A function is a repeatable, i.e. reusable, set of instructions.
Two types:
user-defined functions
built-in functions
A function can have a parameter passed into it. Arguments are the values that are passed into the parameter
What is type hinting?
We can type hint parameters and return types to ensure inputs and outputs are as expected
How do we use optional/default parameters?
Optional parameters (i.e. ones with default argument values) should always be at the end of the parameter list.