note 76337 added to function.explode
| From: | Meercat9 at osu1 dot php dot net | Date: | Wed, 11 Jul 2007 09:50:35 +0000 |
| Subject: | note 76337 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128374@lists.php.net to get a copy of this message | ||
I was just wondering, is there a way to get each character as an array, I did a brief scan of the
functions list and couldn't find something at first, and you can't do this in explode
because the delimerater (or whatever you call it) cannot be null.
As you can probably tell by this program, it's just a function to work out a word's value
according to the sum of the old primary school secret code of each letter representing a number
equal to its place in the alphabet.
<?php
function alpha_value($q){
$p = explode("",$q);
foreach($p as $v){
$v = strtolower($v);
if($v == 'a'){$g = 1;}
if($v == 'b'){$g = 2;}
if($v == 'c'){$g = 3;}
if($v == 'd'){$g = 4;}
if($v == 'e'){$g = 5;}
if($v == 'f'){$g = 6;}
if($v == 'g'){$g = 7;}
if($v == 'h'){$g = 8;}
if($v == 'i'){$g = 9;}
if($v == 'j'){$g = 10;}
if($v == 'k'){$g = 11;}
if($v == 'l'){$g = 12;}
if($v == 'm'){$g = 13;}
if($v == 'n'){$g = 14;}
if($v == 'o'){$g = 15;}
if($v == 'p'){$g = 16;}
if($v == 'q'){$g = 17;}
if($v == 'r'){$g = 18;}
if($v == 's'){$g = 19;}
if($v == 't'){$g = 20;}
if($v == 'u'){$g = 21;}
if($v == 'v'){$g = 22;}
if($v == 'w'){$g = 23;}
if($v == 'x'){$g = 24;}
if($v == 'y'){$g = 25;}
if($v == 'z'){$g = 26;}
$total = $total + $g;
}
return $total;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 124.183.114.216
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit -- https://master.php.net/note/edit/76337
Del: integrated -- https://master.php.net/note/delete/76337/integrated
Del: useless -- https://master.php.net/note/delete/76337/useless
Del: bad code -- https://master.php.net/note/delete/76337/bad+code
Del: spam -- https://master.php.net/note/delete/76337/spam
Del: non-english -- https://master.php.net/note/delete/76337/non-english
Del: in docs -- https://master.php.net/note/delete/76337/in+docs
Del: other reasons-- https://master.php.net/note/delete/76337
Reject -- https://master.php.net/note/reject/76337
Search -- https://master.php.net/manage/user-notes.php