note 43581 deleted from function.str-replace by felipe
| From: | felipe@php.net | Date: | Sun, 09 Dec 2007 15:44:30 +0000 |
| Subject: | note 43581 deleted from function.str-replace by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133030@lists.php.net to get a copy of this message | ||
Note Submitter: aidan at php dot net
----
If you would like to convert tabs to spaces, you could use the code:
<?php
str_replace("\t", " ", $text);
?>
However, sometimes this is not good enough. To be technically correct, a tab is not 4 spaces, a tab
shifts the text to the next predefined column. Usually these predefined columns occur every 4 spaces
from the start of the line.
If you want to convert tabs to spaces while ensuring consistant formatting, try this function...
http://aidanlister.com/repos/v/function.tab2space.php