Snippet Information
Version: 14 (see latest version)
Author: alex
Language: php4
Licensed under GNU GPL v3
Other versions
"prop_search1" v.14 (see latest version)
Description
This snippet is insanely great.
Run
| View code [+] |
Create a snippet based on this »
<?php
$str = "Hi world. It's a beautiful/day. Hi?how are you,yeah!okay.";
echo $str."<br><br>";
// ideally, would have code to replace all non-letters and apostrophe's with spaces.
$str = strip_tags($str);
$str = stripcslashes($str); // Unquotes a string quoted with addcslashes()
$str = stripslashes($str); // Unquotes a string quoted with addslashes()
$str = str_replace("/"," ",$str); // replace slashes with spaces
$str = str_replace("."," ",$str); // replace periods with spaces
$str = str_replace(","," ",$str);
$str = str_replace(";"," ",$str);
$str = str_replace(":"," ",$str);
$str = str_replace("!"," ",$str);
$str = str_replace("?"," ",$str);
$str = explode(" ",$str);
print_r ($str)."<br><br>";
$str = strtolower($str); // makes all characters lowercase
print_r ($str)."<br><br>";
// $str2 = sort($str);
sort($str);
foreach ($str as $key => $val) { echo "str[" . $key . "] = " . $val . "\n";}
print_r ($str);
?>

Comments (0) | View comments for all versions (0)
Log in if you have a Kogbox account.