The Answer Archive
Providing students and professionals with answers to their toughest software, technology, math, and science problems. Browse the Archive!
Search Questions and Answers:

Show only unanswered questions

Replaces

Posted by admin on 25 Sep 2008 at 08:03 PM
$5.00

Programming Languages / PHP

Hi!

I was wondering if you knew which replace function takes the least performance toll out of ereg_replace, preg_replace, and str_replace?

Thanks!

Accepted Answer:

Answer provided by admin on 25 Sep 2008 at 08:03 PM

Hi there,
While I haven't actually looked at the source code for PHP5 recently, I would assume that str_replace had the least performance toll as it is a far simpler function. Bear in mind, however, that either preg_replace or ereg_replace may be more suitable (and more efficient) based on your needs. Although in the end you could probably execute each function 100 times a second, so the performance impact of any function will be minimal unless you have to use it quite frequently in your scripts.

Rating: * * * * *      Awarded: $5.00
Ask a Question
Most Recent Questions
Most Recent Answers
Home Page

Login
Register

Information Technology
Software, Hardware, Design

Programming Languages
- ASP and ASP.NET
- Assembly and Machine Lang
- C and C++
- C#
- Carbon (Macintosh)
- Cold Fusion
- Delphi
- Flash
- FoxPro
- HTML and XHTML
- Java
- Javascript and JScript
- JSP
- Perl
- PHP
- Python
- Ruby on Rails
- VB, VBA, and VB.NET
- VBScript
- XML and XSL
Database
Graphic Design
Operating Platforms
Hardware and Networking

Math and Science
Homework Help

Biology and Geology
Math and Statistics
Chemistry
Physics
Engineering

Are you an information
technology or
math/science expert?

You can earn money by
providing answers to questions
at AnswerArchive.com.
Learn How

Browse Archive | Ask a Question | Most Recent Questions | Most Recent Answers | Home Page | Contact Us | Help
(c) 2008 The Answer Archive