php can be replaced in a loop. The method is: 1. Create a PHP sample file; 2. Loop through "for($i=1;$i
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
Can php be replaced in a loop?
php can be replaced in a loop.
#php loop replaces the simple implementation method in turn:
$o['des'] = existing employees
, including front-line senior techniciansThere are
people for intermediate skilled workers,junior technicians, and
people for other personnel.The purpose is to replace all into input boxes
<?php $num = substr_count($o['des'],'###'); //4 $str = $o['des']; ---注意$str的位置,在for循环外面 for($i=1;$i<=$num;$i++){ $in = "<input type='text' class='space' name='in$i'/>"; $str = preg_replace("/###/","$in",$str,1); --注意变量名称必须与要查找到字符串变量名一致,因为是循环替换每一个,要变成不同name值。 } echo $str; ?>###The last parameter (N) of preg_replace is to replace several, here I think it needs to be replaced with different names in sequence value, so it is appropriate to replace them one at a time. ###### Recommended learning: "###PHP Video Tutorial###"###
The above is the detailed content of Can php be replaced in a loop?. For more information, please follow other related articles on the PHP Chinese website!

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
