Fibonacci series means to get next term by adding its previous two numbers. For an example:- 0 1 1 2 3 5 8 13 21 Here I am writing the PHP program to print Fibonacci Series. <?php function printFabonacciSeries($number){ $a = 0; // first number of series $b = 1; // second number of series echo ‘Fabonacci Series <br/>’; echo $a.’ ‘.$b; for($i=2;$i<$number;$i++){ $c = $a + $b; //print next number of series echo ‘ ‘.$third; $a = $b; $b = $c; } } printFabonacciSeries(9); ?> Output :- 0 1 1 2 3 5 8 13 21 Alternate Way…
Author: phpmypassion
PHP Introduction
What is PHP:- PHP stands for PHP: Hypertext Preprocessor , it is widely – used server side scripting language designed for web devlopment. PHP also used as a general purpose programming language. It was build up by Rasmus Lerdorf in 1994 and launched in the market in 1995. PHP is the most well known scripting language on the web. It is utilized to improve site pages. Using PHP, you can do things like a login page and login a user by creating session, check details from a form, create forums, picture galleries, surveys, and…
Top 35 PHP Interview Questions and Answers for 5 year experience
This article shows top 35 frequently asked PHP interview questions and answers for 5 years experienced PHP Developer, This list of PHP interview questions and answers will be helpful for PHP 5 experienced developer. Question #1 – How array_walk function works in PHP? It is used to update the elements/index of original array. How: in array_walk, two parameter are required. original array An callback function, with use of we update the array. Question #2 – What is the difference between $message and $$message? They are both variables But $message is a…
Job | Urgent_Full Stack(NodeJs /Java/PHP) with Product Base MNC Gurgaon
Experience required for the Job: 1 – 10 years Annual Salary of the Job: 5.00 – 22.00 Lacs Based Company Gurgaon Job Location: Gurgaon # Present Company & Location : # Your current Salary : # Your Expected Salary : # Official Notice Period : # Are you able to join Immediate : # Total Exp. In years and months : # Exp in UI Lead /Tech Lead in Years and months: # Exp. In Java in years and months : # Exp. In PHP in years and months : # Exp. In Node…
Factorial Program in PHP
image source : google images The factorial of number n is multiplying given integer with the sequence of its descending positive integers. we denoted the factorial of a number n by n! in mathematics. Here I am writing factorial program in PHP.. Example :- 5! = 5*4*3*2*1 = 120 7! = 7*6*5*4*3*2*1 = 5040 Here are writing the PHP program to find a factorial of a number. <?php function factorial($number){ $factorial = 1; for($x=$number;$x>=1;$x–){ $factorial = $factorial*$x; } return $factorial; } echo ‘factorial is=’.factorial(11); ?> Output :- factorial…
How To Start A PHP Session ?
Session is a special technique to store information of a user across the multiple pages. To begin with a new session, simply we use the PHP session_start() function. It is must to start a session in the top of every page. Session variables are set with the PHP global variable $_SESSION. Below is the simple example to start a new session. <?php // Start the sessionsession_start(); ?> <!DOCTYPE html> <html> <body> <b> my website </b> </body> </html> Creation & Accessing Session Data :- You can create session using $_SESSION[] php function.…
What Is PHP Session?
Definition :- A session is use to store details of a user across multiple pages. Session is technique to recognized a user from single page to all pages in one application. How the php session works :- When you open a website on browser, its create a session variable to store your information’s until you close the application. Your system knows who you are. It knows the time when you start the application and when you close it. Mostly when someone login to a website, as per programming it create a…
Send Get / Post Data Using PHP CURL
In this tutorial, I am explaining How to send Get / Post PHP curl Request with Parameters . I am explaining 3 types of curl request with an example of S2S communication. #PHP Simple cUrl Request Without Parameter. You can use below code to send CURL request with parameter. <?php $AffPostbackUrl = ‘https://phpmypassion.com’; curl_request($AffPostbackUrl); function curl_request($url, array $options = array()) { $defaults = array( CURLOPT_POST => 0, CURLOPT_HEADER => 0, CURLOPT_URL => $url, CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 0, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 4 ); $ch = curl_init(); curl_setopt_array($ch,…
How To Generate And Download A Dynamic Excel Sheet Using PHP ?
I have got lot of queries regarding to generate an excel sheet and download that on the system using PHP. So I thought to share the proper solution with an article. You can download an excel by using two process. either you can use function to download excel sheet or you can use PHP code on the same page to download a dynamic excel sheet. So here I am going to describe both the process. you can use according to your ease. #Process 1: Download an excel using PHP script…
How To Reverse A String In PHP ?
Commonly in interview we have been asked about reverse a string. So here I am going to share the solution for this type of question with my article. Image source : google images This is a basic question but most of the developers are stuck in it due to hesitation of interview. Interviewer only want to ask the main logic to reverse a string. He can either ask the function in php to reverse a string or also ask about procedural logic behind this. You can reverse a string using…
