Web development
Publié le - 2038 aff. -

What is PHP str_replace() function ?

The majority of php development company currently using php to satisfy their customers. In fact, this programming language promises many features and an unparalleled dynamism. But what especially interests us today is the str_replace () function. The latter's role is to return an array or string. Ie all occurences of search in subject are replaced with replace. It is very useful especially if you do not need fancy replacing rules as regular expressions, for example. You can use it in exchange for preg_replace ().

The parameter list

If your parameters search and replace correspond to the tables, your str_replace () function will then prenre the value of each table will then use them to search and replace on subject. In the event that replace parameters has less value than the search parameters, and use an empty string as the value for the rest of replacement values. If the replace parameter is a character string as the search parameter remains a table, the replacement string will then be used for each search value. If replace and search are both tables then each of the components will be processed the first to the last.

To remember

Search is defined as the mask. That’s means, it is the value to search. It is possible that a table can be used to refer to a few masks.
Replace is the replacement value that you replace the values found. A table can also be used to designate several replacement values or several replace.

Subject, also known as the haystack is the string or just the table on which you have to search and replacement. If there is a table, the replacement will be done on each of its elements. In this case, the return value is also a table.

Count will contain the number of replacements in case it will be provided. This is a single variable.

The return value is a function which is to return a string or an array that contains the replaced values.

Les publications similaires de "Mobile development"

  1. 3 Déc. 2021A PHP Developer's Website: What Type of Information Can We Find?179 aff.
  2. 27 Oct. 2021"Which Companies Offer Great Rewards for Their PHP Programmers?"209 aff.
  3. 29 Mai 2021Developer, coder, programmer: a trendy and evolving profession303 aff.
  4. 21 Mars 2021SEO and development are related425 aff.
  5. 6 Mars 2021Generate HTML code with PHP519 aff.
  6. 18 Fév. 2021Choosing the right web servers497 aff.
  7. 18 Déc. 2020Advanced solutions in Php development656 aff.
  8. 5 Déc. 2020Pros and cons of php website development634 aff.
  9. 7 Nov. 2020Mastering custom Php application development644 aff.
  10. 9 Août 2020World leading Php Company : SimplyPhp669 aff.
  11. 17 Mai 2020Hiring the best Php programmer around726 aff.
  12. 9 Avril 2020What a PHP developer can offer829 aff.
  13. 8 Mars 2020What are the best ways to find a good php company824 aff.
  14. 20 Avril 2019Simplyphp : Your Php development company online994 aff.
  15. 6 Avril 2018Mobile development and web protection1344 aff.