str replace PHP | php string functions

 
  • HOME  • tutorials  • photos   • free grafics design  • maps
     

CATEGORIES
EXCEL TUTORIAL
SQL TUTORIAL
WEB INFORMATION
WINDOWS
JAVASCRIPT SCRIPTS
COMPUTER SECURITY
GRAFIC DESIGN
HTML
PHP
CSS STYLE
ATLAS OF THE WORLD
DEVELOPER
PHOTOSHOP
MAGAZINE
TOP LISTS
LATEST ARTICLES
sql inject protection without complicated class php script and tutorial
how to insert decimal values into a sql
free php and ajax captcha scripts
detect and block uppercase up letters in a string text form input php script
php googlebot detection script
replace breaking lines text, textarea input php
php login script, free login script in php
Remote SQL Database Connection Script Php
Bot Detect Script Php Search Engine Automatic
PHP String Functions
Php Upload Script
   • Str Replace PHP
  PHP » PHP STRING FUNCTIONS » STR REPLACE PHP
google ads
 


STR REPLACE PHP - PHP STRING FUNCTIONS
 
str_replace () PHP functions


Function str_replace () replaces the values in a search string from a string. Str_replace usually be replaced by a value found with a defined or specified. Position is indicated in all cases where no appropriate definition of complex rules are recommended when ereg_replace () or preg_replace  ()

PHP SYNTAX :
str_replace(search,replace,initialstring,count);


search = Required. Specifies the value to find ;
replace = Required. Specifies the value to replace the value in find ;
initialstring = Required. Specifies the string to be searched ;
count = Optional. A variable that counts the number of replacements ;
EXAMPLES FOR str_replace PHP function :
1.

<?php
echo str_replace("red","blue","The sky is red !");
?>


Result:

The sky is blue !

2.

<?php
$list_array = array("two","one","three","four","two");
print_r(str_replace("two","nine",$list_array,$i));
echo "Replacements: $i";
?>


Array
(
[0] => nine
[1] => one
[2] => three
[3] => four
[4]=> nine

)
Replacements: 2

3.

<?php

$initialstring='The sky is red !';
echo str_replace("red","blue",$initialstring);
?>


the output is:

The sky is blue!







google ads

 

 

 

the latest articles :
• MD5 hash generator Online tools Windows Linux C Php
• Remove duplicates in html lines online javascript
• documentgetElementById()innerHTML javascript set Example
• How to block processes from starting and running in Windows XP
• List of us american presidents with pictures
• Ucwords javascript convert online tool
• Hex to rgb converter javascript for colors online
• Letter-spacing CSS property for html pages
• SQL Inject protection without complicated class php script and tutorial
• How to insert decimal values into a SQL table row

 

 
 
Copyright ©2008- www.himmera.com

top

eXTReMe Tracker