PHP Classes

File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/replace.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/replace.php  >  Download  
File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/replace.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 3 months ago
Size: 641 bytes
 

Contents

Class file image Download
<?php

$string
= "It's wabbit season!\n";
print(
str_replace("wabbit", "duck", $string));

$string = str_replace("wabbit", "", $string);
// $string = str_replace("wabbit", "duck", $string);

print $string;

$string = "I like bacon and a hamburger\n";
$ugly_words = array("hamburger", "bacon", "bucket o'grease");
$string = str_replace($ugly_words, "Atkins-friendly foods", $string);
print
$string;

$string = "I like bacon and a hamburger\n";
$ugly_words = array("hamburger", "bacon", "bucket o'grease");
$replacements = array("carrot", "broccoli", "2% milk");
$string = str_replace($ugly_words, $replacements, $string);
print
$string;

?>

For more information send a message to info at phpclasses dot org.