Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > OSX and PHP escape codes?

OSX and PHP escape codes?
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jun 24, 2002, 06:19 PM
 
Hi there,
I'm using Apache and PHP in OSX, but for some reason my output is ignoring my escape codes.
For example the code
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">&lt;?php
$lengths = array(0, 107, 202, 400, 475);
foreach($lengths as $cm)
{
$inch = (100 * $cm) / 2.45;
echo &quot;$cm centimeters = $inch inches\n&quot;;
}
?&gt; </pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Is outputting this:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">0 centimeters = 0 inches 107 centimeters = 4367.3469387755 inches 202 centimeters = 8244.8979591837 inches 400 centimeters = 16326.530612245 inches 475 centimeters = 19387.755102041 inches </pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">instead of this:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">0 centimeters = 0 inches
107 centimeters = 4367.3469387755 inches
202 centimeters = 8244.8979591837 inches
400 centimeters = 16326.530612245 inches
475 centimeters = 19387.755102041 inches </pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Has anyone run into this before? I'm using the default instalation of apache (1.3) with the entropy.ch PHP module for OS X.
Any help is appreciated.

<small>[ 06-24-2002, 07:23 PM: Message edited by: CleaningMan ]</small>
     
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
Jun 24, 2002, 06:33 PM
 
Are you sure that you aren't getting the correct output?

I assume that the output you copied from a web browser.
If that is the case, that I would suggest that you look
at the HTML source of the page and see if the new
lines happen to be there.

<small>[ 06-24-2002, 07:35 PM: Message edited by: Mactoid ]</small>
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
Fresh-Faced Recruit
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jun 24, 2002, 06:47 PM
 
A-Ha! Thank you!
Yes, in the HTML source there were new lines.
I substituted &lt;BR&gt; for \n and got the results I was looking for.

Sorry if this was obvious. I'm just learning PHP, my book's sample code made it look like \n would work.

Thanks for your help.

-CleaningMan

<small>[ 06-24-2002, 07:48 PM: Message edited by: CleaningMan ]</small>
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:38 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2