In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to replace the value of an array with an asterisk by php". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how php replaces the value of an array to an asterisk.
You can replace the array value with an asterisk with array_splice (). If you want to replace only one value, you can use "array_splice (array, start position, 1, *"); if you want to replace multiple values, you can use "array_splice (array, position, replace number, replace array)", which contains multiple replacement values.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In php, you can use the array_splice () function to replace the value of an array with an asterisk.
Array_splice () is a powerful function that removes, inserts, and replaces elements.
Using the array_splice () function, you can replace a specified number of elements from a specified position. If you replace multiple values, the replacement value can be an array.
Array_splice ($array,$start,$length,$replacement)
Parameters:
Arr represents an array.
Start indicates where to start the deletion (subscript):
If start is positive, it is deleted from after going.
If the start is negative, it is deleted from back to front, starting from the end of the arr-start. For example,-2 means starting with the penultimate element of the array.
Length is an optional parameter that indicates the number of elements deleted:
If length is positive, it means deleting length elements
If length is negative, all elements from start to the reciprocal length at the end of the array will be deleted
If omitted, all elements from start to the end of the array are deleted.
Replacement is an optional parameter that represents the value to replace. If replacement has more than one value, it needs to be set to an array, and if there is only one value, it can not be set to an array.
If you are performing a replacement operation, the duration value and the number of replacement need to be the same.
Example 1: one value of the replacement array is an asterisk
Example 2: multiple values of the replacement array are asterisks
If multiple values are replaced, the replacement value is an array; and the number of substitutions should be the same as the length of the replacement array.
At this point, I believe you have a deeper understanding of "how to replace the value of an array with an asterisk by php". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.