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 Link to comment https://forums.phpfreaks.com/topic/8975-getting-an-ascii-value-of-a-letter/ 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 Link to comment https://forums.phpfreaks.com/topic/8975-getting-an-ascii-value-of-a-letter/#findComment-32985 Share on other sites More sharing options...
predator12341 Posted May 3, 2006 Author Share Posted May 3, 2006 kool thanks man Link to comment https://forums.phpfreaks.com/topic/8975-getting-an-ascii-value-of-a-letter/#findComment-32992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.