0

Is it possible to format text with php as in whenever php sees ~ in text it would put <br>.
I am not sure if it is possible as i am new to php.

4
Contributors
8
Replies
18
Views
11 Years
Discussion Span
Last Post by Electrohead
-1

Formatting in PHP is quite simple, really.

heres an example of echoing some bold text:

<?php
echo "<b>Hello World</b>";
?>

Also, newlines in PHP (ie <br/>) are output like this:

echo "Hello\nWorld"

The above would make:

Hello
World
I hope this has helped you :D
Cheers

Votes + Comments
Post does not apply to the question.
0

I know how to do that too what i want is for the php to look into what is posted out of DB and find any tildas (~) and put <br> flag there instead of (~).
Now you you understand what i mean as i have no other way of explaing the problem as i am new to php

0

Well, if you have a string, and you want to replace parts of that string with another string, maybe you should search for a PHP command to replace strings.

str_replace()

0

You might be better to save the actual html to the database, or bbcode. There are plenty of scripts to help automate that. Let us know if you need any pointers.

Sarah

0

Hi,

What kind of script are you talking about as i am unsure what you mean about scripts.

THX

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.