How can the width of a table be adjusted in PHP?
To adjust the width of a table in PHP, you can use inline CSS within the table tag to set the desired width. You can specify the width in pixels, percentage, or any other CSS unit. This allows you to control the visual layout of the table within your PHP code.
echo '<table style="width: 50%;">';
echo '<tr>';
echo '<td>Cell 1</td>';
echo '<td>Cell 2</td>';
echo '</tr>';
echo '</table>';
Related Questions
- How can a beginner efficiently use the explode() function in PHP to separate data?
- What additional security measures, such as preventing session hijacking through JavaScript, should be considered when implementing PHP sessions for web development?
- What potential security risks should be considered when using PHP to interact with a MySQL database?