PHP Logical question

We are showing simple program of php. You can ask me any query by comments. All program are very useful to increase your logical power. It’s very important for your interviews. You can share your ideas to complete programs to different ways. We’ll highlight your ideas.

1. Fibonacci Series Program in PHP

[code]<?php
function displayFibonacci($n){
$fst = 0;
$scnd = 1;
echo “Fibonacci Series: \n”;
echo $fst.’ ‘.$scnd.’ ‘;for($i = 2; $i < $n; $i++){
$third = $fst + $scnd;
echo $third.’ ‘;
$fst = $scnd;
$scnd = $third;
}
}
displayFibonacci(10);
?>

Output : Fibonacci Series: 0 1 1 2 3 5 8 13 21 34
[/code]

2. Armstrong number Program in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

11 − eleven =