maxudaskin Posted February 22, 2008 Share Posted February 22, 2008 Is it possible for PHP differentiate between an uppercase and lowercase letter? Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/ Share on other sites More sharing options...
drisate Posted February 22, 2008 Share Posted February 22, 2008 if you convert a string to upper case and if it doesn't change compared to the way it looked like before... it's already uppercase if (strtoupper($the_string) == $the_string) { echo '$the_string contains only upper case letters and maybe other non-letter characters'; } Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-473282 Share on other sites More sharing options...
maxudaskin Posted February 22, 2008 Author Share Posted February 22, 2008 I mean like, I wanted it to explode (except put every letter instead of every word or whatever seperated by a colon for example)... then check the letter and the case. After that, it will echo an image of a letter in a font only I have... Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-473310 Share on other sites More sharing options...
maxudaskin Posted February 22, 2008 Author Share Posted February 22, 2008 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-473316 Share on other sites More sharing options...
effigy Posted February 22, 2008 Share Posted February 22, 2008 Example? Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-473620 Share on other sites More sharing options...
maxudaskin Posted February 22, 2008 Author Share Posted February 22, 2008 MySQL Query: ['OOM0100'],['Max Udaskin'],['CYYZ-CYUL']['763']['Departing'] To output with the letters, and a space between each array thing.... Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-473791 Share on other sites More sharing options...
effigy Posted February 22, 2008 Share Posted February 22, 2008 <pre> <?php $data = "['OOM0100'],['Max Udaskin'],['CYYZ-CYUL']['763']['Departing']"; preg_match_all('/[A-Z]/', $data, $matches); print_r($matches); echo implode(' ', $matches[0]); ?> </pre> Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-473806 Share on other sites More sharing options...
Bauer418 Posted February 22, 2008 Share Posted February 22, 2008 For single character checks, you can do the strtoupper versus the original string as posted before, or use the PHP ord() function, and compare it with ASCII values for lowercase/uppercase letters. ASCII values for lowercase: 97-122 ASCII values for uppercase: 65-90 Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-473810 Share on other sites More sharing options...
maxudaskin Posted February 23, 2008 Author Share Posted February 23, 2008 How would I replace the character with a picture? Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-474210 Share on other sites More sharing options...
Barand Posted February 23, 2008 Share Posted February 23, 2008 <?php $a = range('A', 'Z'); $trans = array(' ' => ' '); foreach ($a as $k) { $trans[$k] = "<img src='$k.png' />"; } $data = "A B C D"; echo strtr ($data, $trans); ?> gives--> <img src='A.png' /> <img src='B.png' /> <img src='C.png' /> <img src='D.png' /> Quote Link to comment https://forums.phpfreaks.com/topic/92374-case-differentiation/#findComment-474373 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.