Hack Forums
[PHP] unicode int values - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] unicode int values (/showthread.php?tid=5817236)



unicode int values - PDGLOBAL - Mar 27, 2018

Hello, I was wondering if anyone could tell me an easy way to get the int value of a unicode char?

I really would like to be able to do this to allow my DARTIS library to be able to transmit data between java/php/autoit.

Thanks in advance!


RE: unicode int values - m0noxide - Mar 27, 2018

Call the mb_ord() function on a character but you have to be using PHP7.2 or above.

PHP Code

<?php 
echo mb_ord('a'); 



RE: unicode int values - PDGLOBAL - Mar 28, 2018

any solutions for php 5.6?


RE: unicode int values - m0noxide - Mar 28, 2018



Try this out, I found this from the PHP manual


RE: unicode int values - PDGLOBAL - Mar 28, 2018

(Mar 28, 2018 12:25 AM)m0noxide Wrote:  

Try this out, I found this from the PHP manual
Thanks man, however,
how would I convert it back into it's char from the unicode value? Need to be able to reverse this in order to know if it works properly.


I got it working after a couple of edits, the code you posted seems a little broken, but I got it working, though I'm not 100% sure if I'm using it right.


After some testing, any non ascii chr always gets returned as an @ sign, not 100% how to use this, or how to revert it.


You can see my code here: https://github.com/pdglobal/DARTIS-PHP/blob/master/crypt.php


Found a solution https://stackoverflow.com/questions/49536892/charat0-in-php