Click here to Skip to main content
15,867,686 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
GeneralRe: Problem with PHP - FastCGI - Headers Pin
nickmaroulis8-Feb-11 9:36
nickmaroulis8-Feb-11 9:36 
GeneralRe: Problem with PHP - FastCGI - Headers Pin
Lea Hayes8-Feb-11 15:14
Lea Hayes8-Feb-11 15:14 
GeneralRe: Problem with PHP - FastCGI - Headers Pin
nickmaroulis8-Feb-11 15:54
nickmaroulis8-Feb-11 15:54 
QuestionCreating file headers in php. Pin
Danzy8330-Jan-11 2:57
Danzy8330-Jan-11 2:57 
AnswerRe: Creating file headers in php. Pin
cjoki31-Jan-11 4:56
cjoki31-Jan-11 4:56 
AnswerRe: Creating file headers in php. Pin
Niall Barr31-Jan-11 11:51
professionalNiall Barr31-Jan-11 11:51 
GeneralRe: Creating file headers in php. [modified] Pin
Danzy8331-Jan-11 12:49
Danzy8331-Jan-11 12:49 
GeneralRe: Creating file headers in php. Pin
Niall Barr31-Jan-11 23:44
professionalNiall Barr31-Jan-11 23:44 
This bit of code shows you how to write an integer to an ASCII text file, then (as a four byte long) to a binary file. The key thing is that pack is used to convert the integer into a character array equivalent to its binary representation before writing it. The default behavior of PHP when writing variables to a file is to convert them to strings.

<?php
$myinteger = 234;

$fp1 = fopen("ascii_text_file.txt", "w");
fwrite($fp1,$myinteger); // writes a text representation of my integer;
fclose($fp1);

$fp2 = fopen("binary_file.dat", "w");
$data = pack("l",$myinteger); // create char array equivalent to a 'long' containing $myinteger
fwrite($fp2, $data);
fclose($fp2);
?>

GeneralRe: Creating file headers in php. Pin
Danzy831-Feb-11 19:53
Danzy831-Feb-11 19:53 
Questionsending a link to php script Pin
Danzy8327-Jan-11 14:15
Danzy8327-Jan-11 14:15 
AnswerRe: sending a link to php script Pin
Gerben Jongerius27-Jan-11 19:54
Gerben Jongerius27-Jan-11 19:54 
QuestionForm not working... Pin
MacRaider426-Jan-11 7:53
MacRaider426-Jan-11 7:53 
AnswerRe: Form not working... Pin
MacRaider426-Jan-11 8:33
MacRaider426-Jan-11 8:33 
Questioni cant view this file Pin
ulio.pts21-Jan-11 22:24
ulio.pts21-Jan-11 22:24 
AnswerRe: i cant view this file Pin
Kristian Sixhøj24-Jan-11 3:57
Kristian Sixhøj24-Jan-11 3:57 
QuestionThe joys of PHP mail() Pin
SRJ9221-Jan-11 9:46
SRJ9221-Jan-11 9:46 
AnswerRe: The joys of PHP mail() Pin
Dr.Walt Fair, PE21-Jan-11 12:01
professionalDr.Walt Fair, PE21-Jan-11 12:01 
GeneralRe: The joys of PHP mail() Pin
SRJ9221-Jan-11 15:06
SRJ9221-Jan-11 15:06 
GeneralRe: The joys of PHP mail() Pin
Dr.Walt Fair, PE21-Jan-11 15:33
professionalDr.Walt Fair, PE21-Jan-11 15:33 
GeneralRe: The joys of PHP mail() Pin
Fatih P.7-Feb-11 3:10
Fatih P.7-Feb-11 3:10 
AnswerRe: The joys of PHP mail() Pin
chiryphp29-Jan-11 14:46
chiryphp29-Jan-11 14:46 
Questionhtaccess without changing actual url Pin
salman ansari19-Jan-11 20:22
salman ansari19-Jan-11 20:22 
Questionuploading file via post Pin
0b4m418-Jan-11 23:13
0b4m418-Jan-11 23:13 
AnswerRe: uploading file via post Pin
Niall Barr19-Jan-11 2:32
professionalNiall Barr19-Jan-11 2:32 
GeneralRe: uploading file via post Pin
0b4m419-Jan-11 3:27
0b4m419-Jan-11 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.