Simple PHP algorithm problem (to be perfected ...) )
Print only 0
The specific number is determined by the input parameter n
Print 00000 as N=5
Print n 0 based on n value
Print a line 0101010101010101010101
The specific number is determined by the input parameter n
such as test.php?n=3 printing 010
Printing according to n value 010101 ...
Implementation 1 00 111 0000 11111
For if implementation
PHP for ($i$i$i+ +) {for ($j$j $i $j+ +) {if ($i % 2 = = 0 ) {echo ' 0 '; c23/>Else { echo ' 1 '; } } Echo '
';}? >
for&if Statement Implementation
For switch implementation
While if implementation
While switch implementation
php$i = 0; while ($i <) { $j = 0; while ($j$i) { switch ($i % 2) { case 0: echo ' 0 '; Break ; Case 1: echo ' 1 '; Break ; } $j++ ; } Echo '
'; $i+ +;}? >
While&switch Statement Implementation
Implementation 0 01 010 0101 ...
Implementation 0 01 012 0123 3210 210 10 0
Make a calculator.
such as Test.php?a=1&b=2&operator=jia output 3
such as Test.php?a=5&b=2&operator=jian output 3
such as Test.php?a=2&b=5&operator=cheng output 10
such as Test.php?a=6&b=3&operator=chu output 2
Four-bit all-in-one computational function for subtraction processing
Advanced:
Number of daffodils
Bubble Sort Method
The above introduces a simple PHP algorithm problem (with the extension), including the content, I hope the PHP tutorial interested in a friend to help.