Php Remove Charictors From A String

[Solved] Php Remove Charictors From A String | Php - Code Explorer | yomemimo.com
Question : php remove charictors from a string

Answered by : josh-coast

<?php
// Provides: <body text='black'>
$bodytag = str_replace("%body%", "black", "<body text='%body%'>");
// Provides: Hll Wrld f PHP
$vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
$onlyconsonants = str_replace($vowels, "", "Hello World of PHP");
// Provides: You should eat pizza, beer, and ice cream every day
$phrase  = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy   = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);
// Provides: 2
$str = str_replace("ll", "", "good golly miss molly!", $count);
echo $count;
?>

Source : https://www.php.net/manual/en/function.str-replace.php | Last Update : Thu, 19 May 22

Question : php remove control characters from string

Answered by : wicked-worm-8hcrxvq84oh5

preg_replace('/[[:cntrl:]]/', '', $input);

Source : https://stackoverflow.com/questions/1497885/remove-control-characters-from-php-string | Last Update : Tue, 06 Jul 21

Answers related to php remove charictors from a string

Code Explorer Popular Question For Php