ans the questions in your own words Describe two main features of the SVG file f
ID: 3585823 • Letter: A
Question
ans the questions in your own words
Describe two main features of the SVG file format. (2)
What does it mean that PHP is dynamically typed? (2)
What are server-side include files? Why are they important in PHP? (2)
Can we have two functions with the same name in PHP? Why or why not? (2)
How do we define default function parameters in PHP? Provide an example. (3)
What are the superglobal arrays in PHP? (2)
Briefly describe two techniques for reading or writing files in PHP. (2)
Why must you always sanitize user inputs before using them in your queries? (2)
Briefly describe any two database API options available in PHP when connecting to a MySQL database. (3)
Explanation / Answer
Hi,
Could answer 7 out of 9. Below are the solutions-
Ans 1-
1. It include shapes, text and embedded raster graphics, with many different painting styles
2. It supports scripting through languages such as ECMAScript and has comprehensive support for animation.
Ans 2- PHP is dynamically typed becaused it does not associate values strictly with a specific type, but it is designed to "decide" what the type of a value should be at runtime, based on how you are attempting to use it.
Ans 3-
Server side includes (SSI) ia a method for manipulating web pages at the server level before they are sent to the visitor’s web browser. SSI uses tags so when the information is parsed, it cuts and pastes the information from another source into the webpage. It follows below approach-
The server reads the document and parses it for directives.
Follows the instructions (directives) that it finds and merges the results into a final document to deliver to the client's browser
Ans 4- Yes we can have same named functions in PHP but with different number of arguments. This helps use to perform different types of functions from single function as all the types of functions are identical.
Ans 5- By using an assignment operator we can assign default values-
Example-
function foo($test, $x = null, $y = null) {
if (null === $x) {
$x = "New Value";
}
if (null === $y) {
$y = "some other value";
}
}
Ans 6- Superglobals are built-in variables that are always available in all scopes.
These superglobal variables are:
$_COOKIE
$_SESSION
$_REQUEST
$_ENV
$GLOBALS
$_SERVER
$_GET
$_POST
$_FILES
Ans 7-
Reading files-
<?php
// Open Unix file
$handle = fopen("/home/vinaysingh/somefile.txt", "r");
$handle = fopen("c:datainfo.txt", "rt");
?>
Writing to a File-
$myFile1 = "testFolder/abc.txt";
$myFileLink1= fopen($myFile1, 'w+') or die("Can't open file.");
$newContents = "You wrote on me...";
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.