note 43581 modified in function.str-replace by aidan
| From: | aidan@php.net | Date: | Sat, 03 Jul 2004 07:05:46 +0000 |
| Subject: | note 43581 modified in function.str-replace by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72359@lists.php.net to get a copy of this message | ||
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://aidan.dotgeek.org/lib/?file=function.tab2space.php
--was--
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://ircphp.com/users/imho/?file=function.tab2space.php
http://php.net/manual/en/function.str-replace.php