21. How can we encrypt the username and password using php?
24. How do you pass a variable by value in PHP?
25. What does a special set of tags <?= and ?> do in PHP?
26. How do you call a constructor for a parent class?
27. What’s the special meaning of __sleep and __wakeup?
28. What is the difference between PHP and JavaScript?
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);
We can encode data using base64_encode($string) and can decode using base64_decode($string);
22. What is the difference between
explode and split?
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.
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.
23. How do you define a constant?
Constants in PHP are defined using
define() directive, like define("MYCONSTANT", 100);
24. How do you pass a variable by value in PHP?
Just like in C++, put an ampersand
in front of it, like $a = &$b;
25. What does a special set of tags <?= and ?> do in PHP?
The output is displayed
directly to the browser.
26. How do you call a constructor for a parent class?
parent::constructor($value)
27. What’s the special meaning of __sleep and __wakeup?
__sleep returns the array of all the
variables than need to be saved, while __wakeup retrieves them.
28. What is the difference between PHP and JavaScript?
javascript is a client side
scripting language, so javascript can make popups and other things happens on
someone’s PC. While PHP is server side scripting language so it does every
stuff with the server.
29. How can we display information of a variable
and readable by human with PHP?
To be able to display a
human-readable result we use print_r().
30. How is it possible to set an infinite
execution time for PHP script?
The set_time_limit(0) added at the
beginning of a script sets to infinite the time of execution to not have the
PHP error ‘maximum execution time exceeded’.It is also possible to specify this
in the php.ini file.