121⟩ Tell me how can we check the value of a given variable is alphanumeric?
It is possible to use the dedicated function, ctype_alnum to check whether it is an alphanumeric value or not.
“Junior PHP Developer related Frequently Asked Questions in various Junior PHP Developer job interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting”
It is possible to use the dedicated function, ctype_alnum to check whether it is an alphanumeric value or not.
It is possible to pass the variables between the PHP pages using sessions, cookies or hidden form fields.
$a === $b TRUE if $a and $b have the same key/value pairs in the same order and of the same types.
When the original if was followed by : and then the code block without braces.
imagetypes() gives the image format and types supported by the current version of GD-PHP.
SQL injection is a malicious code injection technique. It exploiting SQL vulnerabilities in Web applications
☛ for,
☛ while,
☛ do while and
☛ foreach
for is expressed as follows:
for (expr1; expr2; expr3)
statement
The first expression is executed once at the beginning. In each iteration, expr2 is evaluated. If it is TRUE, the loop continues and the statements inside for are executed. If it evaluates to FALSE, the execution of the loop ends. expr3 is tested at the end of each iteration.
However, foreach provides an easy way to iterate over arrays and it is only used with arrays and objects.
It is possible to propagate a session id via cookies or URL parameters.
Using define() directive, like define ("MYCONSTANT",150)
$filename = "/home/user/guest/myTextFile.txt";
$file = fopen( $filename, "w" );
if( $file == false )
{
echo ( "Error in opening new file" ); exit();
}
fwrite( $file, "This is a simple testn" );
fclose( $file );
Read/Write. Creates a new file. Returns FALSE and an error if file already exists
require() and require_once() perform the same task except that the second function checks if the PHP script is already included or not before executing it.
(same for include_once() and include())
The stripslashes function enables us to remove the escape characters before apostrophes in a string.
We can change the maximum size of files to be uploaded by changing upload_max_filesize in php.ini.
To be able to display the output directly to the browser, we have to use the special tags <?= and ?>.
The most common and used way is to get data into a format supported by Excel. For example, it is possible to write a .csv file, to choose for example comma as separator between fields and then to open the file with Excel.
“13” and 12 can be compared in PHP since it casts everything to the integer type.
The following code can be used for it,
header("Location: http://www.rendc.org/");
PHP includes only single inheritance, it means that a class can be extended from only one single class using the keyword ‘extended’.