21⟩ Do you know what is the default session time in php?
The default session time in php is until closing of browser
“Internee PHP Developer based Frequently Asked Questions in various Internee PHP Developer job interviews by interviewer. These professional questions are here to ensures that you offer a perfect answers posed to you. So get preparation for your new job hunting”
The default session time in php is until closing of browser
Version 7 is the actually used version of PHP.
session_id() returns the session id for the current session.
default session time in PHP is 1440 seconds or 24 minutes
Default session save path id temporary folder /tmp
CRYPT(), MD5()
GET and POST
CONSTRUCTOR : PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.
DESTRUCTORS : PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence.
Split function splits string into array by regular expression. Explode splits a string into array by string.
For Example:
explode(" and", "India and Pakistan and Srilanka");
split(" :", "India : Pakistan : Srilanka");
Both of these functions will return an array that contains India, Pakistan, and Srilanka.
The two most common ways to start and finish a PHP script are:
<?php [ — PHP code—- ] ?> and
<? [— PHP code —] ?>
Yes, it is possible to share a single instance of Memcache between multiple projects. Memcache is a memory store space, and you can run memcache on one or more servers. You can also configure your client to speak to a particular set of instances. So, you can run two different Memcache processes on the same host and yet they are completely independent. Unless, if you have partitioned your data, then it becomes necessary to know from which instance to get the data from or to put into.
To be able to verify whether a PHP variable is an instantiated object of a certain class we use instanceof.
$_FILES[‘userfile’][‘name’] represents the original name of the file on the client machine,
$_FILES[‘userfile’][‘tmp_name’] represents the temporary filename of the file stored on the server.
$a and $b: TRUE if both $a and $b are TRUE.
$a & $b: Bits that are set in both $a and $b are set.
When PHP changes you can update Memcached by
• Clearing the Cache proactively: Clearing the cache when an insert or update is made
• Resetting the Cache: It is similar to the first method but rather than just deleting the keys and waiting for the next request for the data to refresh the cache, reset the values after the insert or update.
The visibility of a property or method must be defined by prefixing the declaration with the keywords public, protected or private.
Class members declared public can be accessed everywhere.
Members declared protected can be accessed only within the class itself and by inherited and parent classes.
Members declared as private may only be accessed by the class that defines the member.
sizeof($array_var)
count($array_var)
You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD("Password");
We can encode data using base64_encode($string) and can decode using base64_decode($string);
☛ printf()- Displays a formatted string
☛ sprintf()-Saves a formatted string in a variable
☛ fprintf() -Prints a formatted string to a file
☛ number_format()-Formats numbers as strings
The goto statement can be placed to enable jumping inside the PHP program. The target is pointed by a label followed by a colon, and the instruction is specified as a goto statement followed by the desired target label.
The session_unregister() function unregister a global variable from the current session and the session_unset() function free all session variables.