main.php382 chars16 lines
In the above program, we take input x from the user using readline() function. We convert the input to integer using type casting (int) to make sure we get a proper value. Then, we initialize an array with first two Fibonacci numbers (0 and 1). Finally, we use a for loop to generate x number of Fibonacci numbers and store them in the array. At last, we output the Fibonacci numbers using implode() function.
gistlibby LogSnag