简单的PHP算法题(带扩充),php算法题扩充
简单的PHP算法题(待完善…)
只打印0
具体个数由输入的参数n决定
如n=5就打印00000
根据n值打印n个0
打印一行 0101010101010101010101
具体个数由输入的参数n决定
如test.php?n=3打印010
根据n值打印010101…
实现1 00 111 0000 11111
for if 实现
php for ($i = 0; $i $i++) { for ($j = 0; $j $i; $j++) { if ($i % 2 == 0) { echo '0'; } else { echo '1'; } } echo ''; } ?> for&if语句实现
for switch 实现
php for ($i = 0; $i $i++) { for ($j = 0; $j $i; $j++) { switch ($j % 2) { case '0': echo "0"; break; case '1': echo "1"; break; } } echo ''; } ?> for&switch语句实现
while if 实现
while switch 实现
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语句实现
实现0 01 010 0101……
实现0 01 012 0123 3210 210 10 0
做个计算器
如test.php?a=1&b=2&operator=jia输出3
如test.php?a=5&b=2&operator=jian输出3
如test.php?a=2&b=5&operator=cheng输出10
如test.php?a=6&b=3&operator=chu输出2
可处理加减乘除的四位一体计算函数
进阶:
水仙花数
冒泡排序法

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software