Re: removing text from a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<?php
$filename = ".htaccess";
$fp =@ fopen($filename, "r") or die ("Couldn't open $filename");
// ENTER ENCODING HERE ..
$encoding = 'UTF-8';
if ($fp)
{
       while (!feof($fp))
       {
                 $thedata =@ fgets($fp);
               // if every number is defonoodle separated by a dot ..
               if (is_string($thedata))
               {
                       $position_of_dot = mb_strpos($thedata, '.', 0,
$encoding);
                       if (is_numeric($position_of_dot) &&
($position_of_dot >= 0))
                               $thedata = trim(mb_substr($thedata,
$position_of_dot,
mb_strlen($thedata, $encoding), $encoding));
               }

                 //print the modified line and \n
       }
}
@fclose($fp);

?>

[mb_strpos] http://in.php.net/manual/en/function.mb-strpos.php
[mb_substr] http://in.php.net/manual/en/function.mb-substr.php

//A yeti

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux