Ninjakreborn Posted April 17, 2006 Share Posted April 17, 2006 I am studying here[a href=\"http://www.hudzilla.org/phpbook/read.php/2_6_2\" target=\"_blank\"]http://www.hudzilla.org/phpbook/read.php/2_6_2[/a]on that specific page, it speaks of various letters that do various things. What is a command line I think it's were you are using a server on your own computer, I will be working for people off there internet server. so I won't have a command line I don't think, it told me about /n would cause a line space. I tried that forever it didn't work, I had to start adding in <br /> to get it, so I know /n doesn't work, which of those others should I use a replacement for instead, and if so, what command would replace each of those like /n is replaced with <br /> when you are doing it on an internet hosting server. Quote Link to comment Share on other sites More sharing options...
trq Posted April 17, 2006 Share Posted April 17, 2006 Your getting a little confused. Php is generally used to output html to a browser. Try this...[code]echo "here is a line\nand another";[/code]View it in your browser and you will see it all on one line, then, right click and go to [i]view source[/i], you will see it split onto two lines.Yes this is most helpfull on the command line (terminal), but it also has its place in the browser evironment.eg, If your reading data from a text file and you want to retain its formatting. $data = data from text file.[code]$data = nl2br($data);echo $data[/code]The nl2br() function adds </ br> tags after newlines chars. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted April 17, 2006 Author Share Posted April 17, 2006 ??completely lost?? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 17, 2006 Share Posted April 17, 2006 Its not /n but \n also when using \n make sure you use it inside double quotes ie:[code]echo "Hi\nBye";[/code]When you run that in a web browser it'll oinly display as HiBye however you'll notice that if you go to view -> source in the browser. Your newline is in fact there[code]HiBye[/code]If you want a newline character you have to use the, line break tag (<br />). This is becuase the browser ignores whispace charaters.But if you use the command line in Windows you'll need to do \r\n for a new line to be inserted otherwise windows wont put in new line character. Other OS like Linux require \n and Macs require \rI would recommend you to download a software package called WAMP. WAMP includes Apache (we server), PHP and MySQL. This enables you to test your PHP scripts localy on your PC. This save a lot time as you have to keep using your clients server to test you scripts. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted April 17, 2006 Author Share Posted April 17, 2006 I think I will do that, but I want to wait a little while because it sounds like I have to learn 2 syntax, one for web development and one for command line, and I don't have a server here, I don't understand anythign about setting up a test server, even with coldfusion, I don't understand any of that, but I am still presisng foward gathering bit by bit of information until i make it through the learning curve, you will see a lot of posts on here from me for awhile.I don't understand lamp, or wamp, because I thought I had to have a server running from my home to install apache, and even if I did wouldn't I have to go through all my scripts and replace /n with <br /> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.