Question 1: How to redirect a page to another?
Answer: You can use header function to redirect.
header('location: http://www.web-technology-experts-notes.in"); //Redirect to home page of another website
header('location: http://www.web-technology-experts-notes.in/2015/11/php-questions-and-answers-for-experienced.html"); //Redirect to another page and another website
header('location: php-questions-and-answers-for-experienced.html"); //Redirect to another page of same website
header('location: php-questions-and-answers-for-experienced.html?topic=php"); //Redirect to another page of same website with parameter
header('Location: http://www.web-technology-experts-notes.in/2015/11/php-questions-and-answers-for-experienced.html', true, 301); //Permanent Redirect
Question 2: Is it secure to store a password in a session?
Answer: If you still need then please stored in encrypted form with different name (not password).
Question 3: How to set/get PHP array in cookie?
Answer: //Set an array in cookie
$arrayData=json_encode(array(1,2,3,4,5,6));
setcookie('no_array', $arrayData);
//Get an array from cookie
$cookie = $_COOKIE['no_array'];
$arrayData = json_decode($cookie);
print_r($arrayData);
Question 4: What is the difference between bindParam and bindValue?
Answer: $string='this is ';
if (strlen($string) != strlen(utf8_decode($string)))
{
echo 'is unicode';
}else{
echo 'It is Not unicode.';
}
Question 5: How to add 30 mins to a date?
Answer: $date = date("Y-m-d H:i:s");
date("Y/m/d h:i:s", strtotime("+30 minutes", $date));
Question 6: How to get Path From URL?
Answer: $url = "http://www.web-technology-experts-notes.in/2013/09/amazon-s3-introduction.html";
$path = parse_url($url);
print_r($path);
/**Array
(
[scheme] => http
[host] => www.web-technology-experts-notes.in
[path] => /2013/09/amazon-s3-introduction.html
)*/
Question 7: How to get array elements which present in two different array?
Answer: $array1 = array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
/**Array ( [a] => green [0] => red )*/
Question 8: How to replace array elements with another another?
Answer: $input = array("red", "green", "blue", "yellow");
array_splice($input, -1, 1, array("black", "maroon"));
print_r($input);
/*Array ( [0] => red [1] => green [2] => blue [3] => black [4] => maroon )*/
Question 9: Count number of elements in an array?
Answer: $foodArray = array('fruits' => array('orange', 'banana', 'apple'),
'veggie' => array('carrot', 'collard', 'pea'));
echo count($foodArray); // output 2
// recursive count
echo count($foodArray, COUNT_RECURSIVE); // output 8
Question 10: How to exchanges all keys with their associated values in an array?
Answer: $input = array("oranges", "apples","mango", "pears");
$flippedArray = array_flip($input);
print_r($flippedArray);
/*Array ( [oranges] => 0 [apples] => 1 [mango] => 2 [pears] => 3 )*/
1. CodeIgniter
Built for PHP programmers, CodeIgniter is one of the powerful PHP frameworks that helps create fully functional web applications. It features excellent user guide document for easy understanding the use of this agile framework. Programmers simply love it due to its ability to develop web applications easy and fast. It help you to get rid from the worry of client’s deadlines.
2. Laravel
It provides common tasks such as routing, authentication, caching, sessions and make development easier for the programmers. It is loaded with aplenty of wonderful features that set it apart from the rest of PHP based open source platforms. It offers many advantages over other PHP base framework.
3. Symfony
It is one of the most efficient PHP frameworks that speed up the development of web applications by helping coder to overcome repetitive coding process. It can be installed easily on any configuration. The requirement of this framework includes windows or UNIX with installed PHP5. It incorporates set of reusable and decoupled components that helps to build the best PHP applications. It compatibility with almost all database make is one of the leading PHP framework to build web applications.
4. Phalcon
It is a high performance PHP framework offer lower resource consumption. For optimize performance, it is implemented as an extension written in C/C++. It is based on MVC pattern and known as a high performance web framework.
5. Yii
It is a component based, objective oriented, high performance PHP framework based on MVC pattern that is best for web 2.0 application development. It comes with a number of rich features such as authentication, caching, testing, Active record etc., and can be used by programmers effortlessly. It helps to reduce development time significantly. It is fast, professional and secure.
6. CakePHP
It is an open source framework for PHP website development written in PHP. It is known as a reliable and tested facility that deliver many benefits to the developers. The desing patterns it uses includes MVC, ActiveRecord, Front Controller and Associate Data mapping. It keeps application secure and safe with its excellent built-in tools. It makes building web application faster and simpler.
7. Zend
It is an object oriented open source web application framework helps developers develop fast, secure and scalable web applications. It is licensed under the New BSD license and implemented in PHP5. It supports for many vendors and database systems such as Microsoft SQL server, Oracle, MariaDB and more. It creates reusable codes that can be used handily for further development. It is the finest PHP frameworks to build custom web based applications.
8. Aura
It provides well tested, high quality, decoupled libraries that are used in any codebase. The Aura project is perfect for them who love decoupled libraries, clean code and independent packages. It helps programmer to take adavantage of available features in PHP 5.4+.
9. Flight
It is extensible, simple yet fast PHP framework enables developers to build web applications quickly and easily.
10. Kohana
It helps to build web application quickly with its rich set of components including database access, translation tools, validation, encryption, code profiling. It is HMVC PHP5 framework built using strict PHP objects and classes. User can add new library and extend existing components. It has active community and IRC channels.