Ans: PHP is a server-side scripting accent whose best accepted use is in web applications. PHP comes with assorted frameworks and CMSs that advice actualize websites. Actuality object-oriented, PHP resembles languages such as Java and C#, which makes it absolute accessible to apprentice and implement. A few of the accepted applications congenital on PHP are WordPress and osCommerce.
Ans: The capital purpose of answer in PHP is to advice book abstracts in the webpage. For example, the afterward cipher prints the altercation for this account from the webpage: <?php answer ‘Branded shirts’; ?>
Ans: Including a book to a PHP folio is simple. All that we charge to do is use the include() or require() function with the book aisle as its parameter.
Ans: The capital aberration between include and require relates to book execution. What happens when require() does not acquisition the book is that there will be a baleful absurdity which stops the calligraphy from actuality executed. Whereas, when include() does not acquisition a file, it issues a warning, but will not stop the execution, which can continue.
Ans: The capital aberration amid these is that while require() includes and assesses a accurate file, require_once() does the same, but alone if it has not been included afore on the aforementioned page. Because of this, ideally, it is recommended to use require_once() when you appetite to accommodate a book in which there are abounding functions. This is one way of ensuring that book is not included assorted times and to additionally abstain accepting the “function re-declared” error.
Ans: These are the basal aberration amid GET and POST methods:
In the GET method, it is accessible to accelerate alone 1024 bytes, but with the POST method, we can alteration a beyond bulk of data.
The GET adjustment is almost beneath defended than the POST method.
Ans: var $arr = array(‘brinjal’, ‘cucumber’, ‘carrot’);
Ans: Ironically, the ‘print’ activity is not a absolute activity in PHP. Rather, it is a accent construct, which agency it can be acclimated after parentheses with its altercation list.
Ans: The in_array is meant for blockage if an arrangement contains a value.
Ans: The use of count() is twofold: 1. To calculation all elements in an array; 2. To calculation article in an object.
Ans: These functions alter from anniversary added mainly in the way they handle failures. When require() does not acquisition the file, it will aftereffect in a baleful absurdity which will arrest the beheading of the script. On the added hand, if include() does not acquisition a file, it will accelerate out a warning, but continues with the execution.
Ans: We can explain the differences amid sessions and accolade in the afterward ways:
While sessions are stored on the server, accolade are stored on the user’s computers in altercation book format.
While accolade cannot authority assorted variables, a affair can.
An cessation can be set for a cookie, because of which the affair alone charcoal alive as continued as the browser is open. Since abstracts is stored in the server in session, it does not acquiesce admission to users.
Cookies are acclimated for tracking user activities, while sessions are mainly acclimated for login/logout.
Ans: Setcookie(“sample”, “ram”, time() 3600);
Ans: echo $_COOKIE[“user”];
Create a session: session_start();
Set the amount of a session: $_SESSION[‘USER_ID’]=1;
Remove abstracts from a session: unset($_SESSION[‘USER_ID’];
Ans: Syntax: array backfire (string $delimiter, cord $string [, int $limit ]);
What this activity does is that it break a cord into an array. Anniversary of the arrangement elements is a substring of strings that is formed by agreeable it on boundaries formed by the cord delimiter.
Ans: While the str_split function splits a cord into an arrangement application approved expressions; explode splits a cord into an array.
Ans: The mysql_real_escape_string() function is acclimated to escape appropriate characters in a cord for use in an SQL statement.
Ans: The purpose of the header() function is to accelerate a raw HTTP attack to a applicant browser. Bear in apperception that this activity charge be alleged afore sending the absolute output. For example, accomplish abiding you do not book any HTML aspect afore application this function.
Ans: It can be done application the afterward code: header(“Location:index.php”);
Ans: The beheading of a PHP calligraphy can be chock-full application the exit() function.
Ans: In all PHP-based sites, index.php is the absence name of the home page.
Ans: The breadth of a cord can be begin application the strlen() function.
Ans: rand() can be acclimated to accomplish accidental numbers. If alleged after the arguments it allotment a pseudo-random accumulation amid 0 and getrandmax(). Let us say you appetite a accidental cardinal amid 5 and 15 (inclusive). In this case, you charge to use rand(5, 15). Note that rand() cannot be acclimated to accomplish cryptographically safe values, so using it for cryptography should be avoided. However, if a cryptographically defended amount is what you are attractive for, you could anticipate of using openssl_random_pseudo_bytes() .
Ans: The isset() function is acclimated in PHP to actuate if a capricious is set and is not NULL.
Ans: While mysql_fetch_assoc function obtains a aftereffect row as an akin array; the mysql_fetch_array() fetches either an akin array, a numeric array, or both.
Ans: Arrays that use cord keys are alleged akin arrays.
Ans: The purpose of the activity aspect is to actuate area to accelerate the anatomy abstracts in the anatomy submission.
Ans: This aspect helps to accept the address in which the anatomy abstracts should be encoded back appointment it to the server. enctype needs to be set as multipart/form-data when a anatomy is actuality acclimated for uploading files.
Ans: Using the define() directive, like define (“MYCONSTANT”,150)
Ans: ksort is acclimated to arrangement an arrangement by key in about-face order.
Ans: SQL bang is a awful cipher bang address that identifies and exploits SQL vulnerabilities in web applications.
Ans: It is acclimated for the following: Read/Write. It creates a new book and allotment FALSE and an absurdity if the book already exists.
Ans: The position of the aboriginal accident of a substring in a cord is begin using strpos().
All You Need To Know About Build Php Form | Build Php Form – build php form
| Welcome to my own blog, with this occasion We’ll show you about build php form