Home Backend Development PHP Tutorial 截取字符串,其后在拼装起来。给个思路各位

截取字符串,其后在拼装起来。给个思路各位

Jun 13, 2016 pm 01:21 PM
ar array str

截取字符串,然后在拼装起来。给个思路各位。
三部处置室护理费+三部处置室护理治疗费+三部处置室化验费+(三部处置室床日总量+三部处置室入院人数*3+三部处置室出院人数*0.3) 把这上面的汉字先截取出来,我会在数据库中获取对应的费用用,然后在拼装好进行运算。我的处理是把运算符都替换为“,”然后以“,”分割这样的方式处理的。现在就是拼装怎么去拼装。

------解决方案--------------------

PHP code
$str = '三部处置室护理费+三部处置室护理治疗费+三部处置室化验费+(三部处置室床日总量+三部处置室入院人数*3+三部处置室出院人数*0.3)';
preg_match_all("|[^0-9*.+()]+|", $str, $matches);
$ar_txt = array_values($matches[0]);
$ar_val = array(1,2,3,4,5,6); //中文项目对应的价格数值
$str = str_replace($ar_txt, $ar_val, $str);
echo $str; //1+2+3+(4+5*3+6*0.3) <div class="clear">
                 
              
              
        
            </div>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

XREAL founder Xu Chi: Apple lets everyone see the future of spatial computing, and we work hard to let everyone see the present of spatial computing. XREAL founder Xu Chi: Apple lets everyone see the future of spatial computing, and we work hard to let everyone see the present of spatial computing. Jun 02, 2024 pm 07:55 PM

XREAL launched a new product - XREALBeamPro at the spatial computing new product launch conference, priced from 1,299 yuan. According to the official introduction, XREALBeamPro is a computing terminal that gradually releases 2D applications into 3D space. Equipped with XREALAR glasses, it will form a "complete consumer-grade AR space computing system" and minimize the migration cost of users from the mobile phone side. In terms of design, XREALBeamPro looks like a smartphone, but it is not a mobile phone product, but a spatial computing terminal equipped with a touch display. It is officially positioned as an “AR spatial computing terminal like a Phone”. At the press conference, XREAL founder and CEO Xu Chi expressed his enthusiasm for BeamPro’s capabilities.

Microsoft explores AR/VR patents using microlens arrays for wide-range chief ray angle manipulation Microsoft explores AR/VR patents using microlens arrays for wide-range chief ray angle manipulation Sep 30, 2023 pm 09:29 PM

(Nweon September 26, 2023) Microsoft believes that MicroLED has the characteristics of small size, light weight, high brightness, and high packaging density, and may be particularly suitable for head-mounted devices that require high resolution, small size, and light weight. monitor. In a patent application titled "Microlenses providing wide range chief ray angle manipulation for panel display", Microsoft introduced a microlens that provides wide range chief ray angle manipulation for panel display, and a display system configured with the microlens array. Wherein, each microlens in the array corresponds to a respective pixel of the panel display. Microlenses are configured according to their

How to build AR/VR applications using PHP How to build AR/VR applications using PHP Jun 11, 2023 pm 07:22 PM

With the development of AR (Augmented Reality) and VR (Virtual Reality), these two technologies have become an important part of innovation and experience. With the popularity of PHP as a network programming language, PHP has become a feasible choice for developing AR/VR applications. This article will introduce how to use PHP to build AR/VR applications. 1. Understand AR and VR technologies Before we start creating AR/VR applications, we need to understand the different technologies and libraries. AR technology allows virtual objects or information to interact with real-world environments. V

Mojie Technology debuted at CES for the first time, leading the AR innovation trend! Mojie Technology debuted at CES for the first time, leading the AR innovation trend! Jan 14, 2024 pm 09:06 PM

From January 9th to 12th, more than 4,000 exhibitors gathered at CES, the consumer electronics "Spring Festival Gala". As an innovative company in the field of consumer AR, Mojie Technology participated in CES for the first time, fully demonstrating the strong strength of Chinese AR companies in core devices, complete machine solutions and customized services. At the Mojie booth, the AR glasses based on binocular resin diffraction light waveguide + MicroLED were displayed, which aroused the interest of many visitors, who tried them on and experienced their functions. This AR glasses has many practical features. First, the wearer can view the text content in real time through the glasses lens, which makes reading more convenient. Secondly, the glasses have built-in microphones that can collect voice information and convert it into text in the specified language through the instant translation function.

NTT QONOQ Devices unveils Mirza wireless XR glasses for smartphones NTT QONOQ Devices unveils Mirza wireless XR glasses for smartphones Sep 09, 2024 pm 06:30 PM

NTT QONOQ Devices has unveiled the Mirza wireless XR glasses for smartphones, freeing users from needing to wrangle cords. The glasses can display virtual AR content in real-world spaces like Pokemon Go or their phone content on a large virtual displ

Sort array using Array.Sort function in C# Sort array using Array.Sort function in C# Nov 18, 2023 am 10:37 AM

Title: Example of using the Array.Sort function to sort an array in C# Text: In C#, array is a commonly used data structure, and it is often necessary to sort the array. C# provides the Array class, which has the Sort method to conveniently sort arrays. This article will demonstrate how to use the Array.Sort function in C# to sort an array and provide specific code examples. First, we need to understand the basic usage of the Array.Sort function. Array.So

Christie: dual drive of technology + innovation brings unlimited possibilities Christie: dual drive of technology + innovation brings unlimited possibilities Apr 23, 2024 am 08:10 AM

As a technology company driven by innovation, Christie is able to provide comprehensive solutions, rich industry experience and a complete service network in intelligent audio-visual technology. At this year's InfoCommChina, Christie brought RGB pure laser projectors, 1DLP laser projectors, LED video walls, and content management and processing solutions. At the event site, a large-scale customized outer spherical dome specially designed for astronomical displays became the focus of the scene. Christie named it "Sphere Deep Space", and the Christie M4K25RGB pure laser projector gave it "green vitality" . Mr. Sheng Xiaoqiang, senior technical service manager of the Commercial Business Department in China, said: It is not difficult to realize an outer spherical dome projection, but it can be made smaller and the color

XREAL Beam Pro released globally with aggressive pricing and launch discounts for XREAL Beam adopters XREAL Beam Pro released globally with aggressive pricing and launch discounts for XREAL Beam adopters Jun 19, 2024 am 09:11 AM

XREAL (formerly Nreal) has not yet started shipping its last product. For context, the company presented the Air 2 Ultra in January at CES 2024, a pair of augmented reality (AR) glasses that build on its earlier efforts with various hardware improvem

See all articles