Avatar of mhoggatt1
mhoggatt1
 asked on

PHP print ascii space to browser

in this section of code that Ray sent me how can it be modified to print actual ASCII spaces to the browser instead of printing the non-ASCII characters?

Here is a section of the code:

// READ THE FILE A CHARACTER (OR A BYTE?) AT A TIME
$fpr = fopen($url, 'r');
if (!$fpr) trigger_error("Unable to read $url", E_USER_ERROR);
$cnt = 0;
while (!feof($fpr))
{
    $cnt++;
    $chr = fgetc($fpr);
    echo PHP_EOL . "$cnt $chr ";
    if (ord($chr) < 128) echo 'ASCII';
}

thanks,
Michael
PHPWeb Languages and StandardsWeb DevelopmentHTMLWeb Browsers

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
SOLUTION
noci

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
mhoggatt1

ASKER
Thanks guys for the input.
Ray, I was just curious as to whether or not if the character wasn't in ascii format that I could print the ASCII spaces to the browser like you did in the getc routine you sent me. I was just curious about whether or not if the QT half-8 character could be replaced with the ASCII space then I could the result of the Bible verse from the browser, put it into a text file and then use the explode to see if that would work. Just thought I would tinker around with the program until you get back with me on the application you are working on for me.

Thanks,

Michael
Ray Paseur

Michael, perhaps I missed an email from you with the specs and test data?  I cannot work on anything without that!  I'm glad to help, but there's just no point in trying piecemeal to guess what data we are working with.  I'll stand by awaiting further information, including the test data.  Best regards, Ray
Ray Paseur

Michael: I hope you're still following this question thread.  I can't teach you advanced PHP concepts in an online forum like this one.  When we ask for test data, and we get test data that has been altered with the addition of hand-written commentary, we are handicapped by the damaged test case.  I urge you, if you want to write PHP code, to study the language and get some familiarity with the principles.  To that end, this article can help you find good learning resources.
https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html
Your help has saved me hundreds of hours of internet surfing.
fblack61