Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution.… Read more
How come the code works, but doesn’t for two-dimensional array of mine?
Any time you have an array with more than one dimension, complex parsing syntax is required. print “Contents: {$arr[1][2]}” would’ve worked.… Read more
What’s the difference between htmlentities() and htmlspecialchars()?
htmlspecialchars only takes care of , single quote ‘, double quote ” and ampersand.
htmlentities translates all occurrences of character sequences that have different meaning in HTML.… Read more
What’s the difference between md5(), crc32() and sha1() crypto on PHP?
The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.… Read more
What is meant by PEAR in php?
Answer1:
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 nicely organised OOP … Read more
How can we repair a MySQL table?
The syntax for repairing a MySQL table is:
REPAIR TABLE tablename
REPAIR TABLE tablename QUICK
REPAIR TABLE tablename EXTENDED
This command will repair the table specified.
If QUICK is given, MySQL will do a repair of only the index tree.
If EXTENDED is given, it will create index row by … Read more
What is the difference between $message and $$message?
Anwser 1:
$message is a simple variable whereas $$message is a reference variable. Example:
$user = ‘user01’
is equivalent to
$holder = ‘user’;
$$holder = ‘user01’;
Anwser 2:
They are both variables. But $message is a variable with a fixed name. $$message is a variable who’s name is stored in … Read more
What is the difference between urlencode and urldecode in php ?
Anwser 1:
urlencode() returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode(“10.00%”) will return “10%2E00%25”. URL encoded strings are safe to be used as part of URLs.
urldecode() returns the URL decoded version of … Read more
How to get the uploaded file Information in the receiving 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 called $_FILES.
Uploaded file information is organized in $_FILES as a two-dimensional … Read more
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 written for the Web CGI interface, it … Read more