Read/Write. Creates a new file. Returns FALSE and an error if file already exists
All posts by Pramod T P
What is the default execution time set in set_time_limit() PHP
The default execution time set in set_time_limit() function is 30 secs.
This function restarts the timer counter form zero and when the number of seconds a script is allowed to run is reached, it returns a fatal error.
What is PHP Nowdocs used for?
Nowdocs are to single-quoted strings what heredocs are to double-quoted strings. A nowdoc is specified similarly to a heredoc, but no parsing is done inside a nowdoc. The construct is ideal for embedding PHP code or other large blocks of text without the need for escaping. It shares some features in common with the SGML <![CDATA[ ]]> construct, in that it declares a block of text which is not for parsing.
A nowdoc is identified with the same <<< sequence used for heredocs, but the identifier which follows is enclosed in single quotes, e.g. <<<‘EOT’. All the rules for heredoc identifiers also apply to nowdoc identifiers, especially those regarding the appearance of the closing identifier.
What is PHP heredoc used for?
Allows creating multiple lines of string without using quotations.
Heredoc is a robust way to create string in PHP with more lines but without using quotations.
Submit form without a submit button PHP
We can do this by using JavaScript code linked to an event trigger of any form field and call the document.form.submit() function in JavaScript code.
What is PEAR in PHP
PEAR is short for “PHP Extension and Application Repository” and a framework and repository for reusable PHP components. . Stig S. Bakken founded the PEAR project in 1999 to promote the re-use of code that performs common functions.The purpose of PEAR is to provide:
- A structured library of open-source code for PHP users
- A system for code distribution and package maintenance
- A standard style for code written in PHP
- PEAR’s mission is to provide reusable components, lead innovation in PHP, provide best practices for PHP development and educate developers.
- Offers a command-line interface that can be used to automatically install “packages”.
PHP echo and print Statements
echo() and print() are language constructs in PHP, both are used to output strings. echo is marginally faster than print.
echo() can take multiple expressions whereas print cannot take multiple expressions.
Print return true or false based on success or failure whereas echo doesn’t return true or false.
Javascript Prompt Box
A prompt box is a box which allows the user to enter input by providing a text box. Label and box will be provided to enter the text or number.
Javascript Global Variables
Global variables are those that are available throughout the length of the code, that is, these have no scope. The var keyword is used to declare a local variable or object. If the var keyword is omitted, a global variable is declared.
Javascript ‘this’ keyword
This’ keyword is used to point at the current object in the code. For instance: If the code is presently at an object created by the help of the ‘new’ keyword, then ‘this’ keyword will point to the object being created.