How to Justify Text in PHP

By Jim Campbell

PHP allows you to create dynamic pages, and you must include the dynamic layout with the PHP code. You can use the paragraph tag to justify the text on your PHP pages. You wrap the

tag around the text you want to justify, and the reader's browser formats the text.

Step 1

Right-click the PHP file you want to edit and select "Open With." Double-click your PHP editor in the list of editor software.

Step 2

Scroll down the page to the section of the PHP code where you want to justify the text.

Step 3

Type the following code around the output text to justify the format:echo "

"echo "

"Place the first line of code before the text you want to justify, and place the second line of code after the text. All text wrapped with the code is justified on the page.

Step 4

Save the changes and run the new code in your PHP debugger or in a Web browser. Notice the text is justified in the browser window.

References & Resources