How to Justify Text in PHP
- 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.
- 2). Scroll down the page to the section of the PHP code where you want to justify the text.
- 3). Type the following code around the output text to justify the format:
echo "<p align='justify'>"
echo "</p>"
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. - 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.
Source...