Sort: Date

File Upload Handling - Getting Uploaded File Information
How To Get the Uploaded File Information in the Receiving PHP Script? Once the Web server received the uploaded file, it will call the PHP script specified in the form action attribute to process them. This receiving PHP script can get the uploaded file information through the predefined array calle...
2016-06-30, 9373👍, 2💬

Octal and Decimal Numbers
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what's the problem? If you assign a variable with a value of 0123, PHP will interpret as an octal number resulting to decimal value of 83. All numbers that preceded with a 0 (zero) will be interpreted...
2007-02-27, 8724👍, 0💬

Tag <?= ... ?> in PHP
What does a special set of tags <?= and ?> do in a PHP script page? <?= expression ?> allows you to output the value of the specified expression into the HTML document directly.
2006-09-01, 8244👍, 0💬

mysql_fetch_object() and mysql_fetch_array() Functions
What is the difference between mysql_fetch_object() and mysql_fetch_array() functions in PHP? mysql_fetch_object() fetches the current row of data from the query result associated with the specified result identifier. The row is returned as an object. See the example code: <?php $result = mys...
2007-02-27, 6912👍, 0💬

urlencode() and urldecode() Functions?
What are urlencode() and urldecode() functions in PHP? string urlencode(str) - Returns the URL encoded version of the input string. String values to be used in URL query string need to be URL encoded. In the URL encoded version: Alphanumeric characters are maintained as is. Space characters are conv...
2007-02-27, 6508👍, 0💬

Variables in Double Quoted Strings
Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example? In this example, "$a dollars" or "{$a} dollars" will print the same result. But in other cases, you need to use curly braces to protect variable names. For example, for following PHP script will prin...
2007-02-27, 6452👍, 0💬

Number of Days between Two Dates
How can we know the number of days between two given dates in PHP? Simple arithmetic: <?php $date1 = date('Y-m-d'); $date2 = '2006-07-01'; $days = (strtotime($date1) - strtotime($date2)) / (60 * 60 * 24); $days = (int) $days; echo "Number of days since '2006-07-01': $days"; ?>
2007-02-27, 6411👍, 0💬

Executing a PHP Script Using Command Line
How can I execute a PHP script using command line? Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program. Be aware that if your PHP script was w...
2007-02-27, 6346👍, 0💬

Persistent Cookies
What Is a Persistent Cookie? A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You shoul...
2007-02-27, 5816👍, 0💬

What is PHP
What is PHP? The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.
2007-02-27, 5711👍, 0💬

What Is a Session
What Is a Session? A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. There is only one session object available to your PHP scripts at any time. Data saved to the session by a script can be retrieved by the same script or another s...
2007-02-27, 5596👍, 0💬

define() - Defining Constants
How do you define a constant in PHP? You can define a constant by using the define() function. Once a constant is defined, it can never be changed or undefined. For example: <?php define("CONSTANT", "Hello world."); echo CONSTANT; // outputs "Hello world." echo Constant; // outputs "Constant"...
2007-02-27, 5581👍, 0💬

require(), include() and include_once() Functions
What are the differences between require(), include() and include_once() functions in PHP? All three functions are used to include and evaluate a file into the current script execution. The include_once() statement includes and evaluates the specified file during the execution of the script. This is...
2007-02-27, 5572👍, 0💬

What Is PEAR
What Is PEAR? PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a n...
2007-02-27, 5456👍, 0💬

Uploading Files with File Input Fields in a Form
How To Write the FORM Tag Correctly for Uploading Files? When users clicks the submit button, files specified in the <INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written <FORM...> tag as: ...
2007-02-27, 5418👍, 0💬

Differences between Simple Variables and Variable Variables
What is the difference between $message and $$message in PHP? $message is a simple variable with a fixed name which is called "message". $$message is a variable variable with a variable name which is stored in another variable called $message. If $message contains "user", $$message is the same as $u...
2007-02-27, 5401👍, 0💬

Uploading Files with File Input Fields in a Form
How To Write the FORM Tag Correctly for Uploading Files? When users clicks the submit button, files specified in the <INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written <FORM...> tag as: ...
2007-02-27, 5303👍, 0💬

  Sort: Date