LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2006, 07:13 PM   #1
joelhop
Member
 
Registered: Mar 2004
Location: Pennsylvania::USA
Distribution: Fedora Core 6
Posts: 100

Rep: Reputation: 15
Question PHP Ascii Question


The function chr() converts a ascii dec value to a ascii chr value.

Example: chr(97) = a
chr(98) = b

..and so on.

Is there a reverse of this?

So I could go from chr value a to dec value 97;

Like, reversechr(a) = 97 ???

Thanks for any help on this!

-KARL
 
Old 12-14-2006, 07:58 PM   #2
demon_vox
Member
 
Registered: May 2006
Location: Argentina
Distribution: SuSE 10
Posts: 173

Rep: Reputation: 30
Hi
what you look for is a function named ord. Just for you to get better, consider using the PHP website (www.php.net) to check the functions. Just by searching chr I got a link to ord.

Keep it in mind
Cheers!
 
Old 12-14-2006, 08:08 PM   #3
joelhop
Member
 
Registered: Mar 2004
Location: Pennsylvania::USA
Distribution: Fedora Core 6
Posts: 100

Original Poster
Rep: Reputation: 15
hey man, thanks again for your help, you've helped me in the past as well. ord() works great a very nice compliment, also thanks for the tip on php.net I'll definitely look more into it. Have a good evening.

Example for anyone looking in the future:

<?php

$j = a;
echo ord($j); //returns 97

?>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[bash] ASCII to HEX and hex to ascii ////// Programming 17 05-08-2018 09:55 PM
PHP Ascii Question joelhop Programming 2 10-11-2006 10:19 AM
PHP / VideoLAN / Fedora Core Question - how can I get the PHP "exec" function to work gtrawoger Linux - Software 3 12-21-2005 06:51 AM
Question about copying lines from Ascii file stewchcken Linux - General 2 09-29-2005 06:22 AM
PERL premature end of script ASCII question Neorio Programming 2 08-08-2003 09:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration