473,513 Members | 2,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

bin2hex()

nabanita
9 New Member
how does the bin2hex() function works? do it changes the original file to its equivalent hexadecimal form or it copies the file to the buffer and works with it??
In the second case, I would like to know if there is a function or a way that would convert the original file to its hexadecimal form
Apr 16 '10 #1
1 1817
Atli
5,058 Recognized Expert Expert
Hey.

The bin2hex function simply takes a string, converts it to it's hexadecimal form, and then returns the new HEX string. (The input string is not altered, unless you overwrite it with the return value, if that is what you are asking.)

To convert an entire file into it's HEX equivalent, you need to load the file into PHP, run the binary string through the function, and then save it or output it or do whatever you want done with it.

Note that a file encoded in HEX is 2x larger than it's binary form, so you may find there are better ways to do whatever it is you want to do with it. (What are you planing to do with it?)
Apr 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
11084
by: Ivan | last post by:
Hi, let's say that my server time is for some reason incorrect! Is there a php function that would automaticly correct that time (give or take a few minutes, hours, days...) so date() function...
4
2590
by: Chuck Anderson | last post by:
I've read some discussions, searched Google, tried pack, unpack, bin2hex, explode, implode, and I just can't figure out how to convert this data. I am trying to read a file with the following...
0
1535
by: Carl S. in 't Veld | last post by:
I am trying to generate tiger tree hashes the same way as directconnect does, but I am failing. I checked the output from php with the reference vectors from...
10
2957
by: dave | last post by:
Hello, I'm creating a site that has several contact email addresses. These are vlid addresses, i'm wondering if i can use php to alter these addresses so that spam harvesters can't get them, yet a...
5
17398
by: Zulik | last post by:
Hello, I might have a bad day today but I have a byte buffer holding binary numbers. Now, I want to convert this to byte buffer with hex numbers. Is there any elegant way of doing that? Some...
10
4673
by: comp.lang.php | last post by:
echo mime_content_type('/var/www/html/video/small.mov'); // 1.5mb Quicktime video returns "video/quicktime" echo mime_content_type('/var/www/html/video/huge.mov'); // 10.5mb Quicktime video...
5
3430
by: Nel | last post by:
I am trying to find a php solution to encoding an md5 hex string into another base. Using ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 as a characters for a base 62 i.e. A =...
4
1636
by: Justin | last post by:
Hi, i need some help on this urgently... Thanx.... The situation is like this, i need to find out the way to convert Chinese characters into hexa code. but the problem is what i got from bin2hex()...
1
4441
by: markurxn | last post by:
I need a solution to automatically change the DPI of uploaded photos from 300 to 72. I've coded this bit of script to read the 14th through 18th bit of binary data of a JPEG and update the DPI. The...
3
2662
by: JimmyR.com | last post by:
I have a binary file which only has 4 bytes "FFFFFFEE". I just want to put it in a variable equaling 4294967278. How I've failed so far: <? $foo= bin2hex(file_get_contents('testplz.bin'));
0
7379
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.