predator12341 Posted May 3, 2006 Share Posted May 3, 2006 hi i wrote a small encryption routine in visual basic and ported it to a few other programming languages but i really want to use it in php. However is there a function so i can get the ascii code for an individual letter and is there a way that i can pick each letter of a string individually for exampletreewill loop and get Tthen will get ther ascii of t 45(this may not be the actually number just showing as example)then after it does that it moves to the next letter which is rthen to e then to e after thatand so on and so onany help would be great thanks Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 3, 2006 Share Posted May 3, 2006 Use the [a href=\"http://www.php.net/ord\" target=\"_blank\"]ord()[/a] function and a for loop:[code]<?php$str = 'This is a test string';for($i=0;$i<strlen($str);$i++) echo $str{$i} . ' = ' . ord($str{$i}) . '<br>';?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
predator12341 Posted May 3, 2006 Author Share Posted May 3, 2006 kool thanks man Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.