Changeset 391


Ignore:
Timestamp:
2007/02/27 21:07:26 (15 years ago)
Author:
uehara
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev/html/test/uehara/test.php

    r8 r391  
    11<?php 
    2 require_once("../../require.php"); 
     2function sfCutStringByte($str, $len) { 
     3    if(strlen($str) > $len) { 
     4        $ret = $str; 
     5        for($i = 1; $len >= $i; $i++) { 
     6            $ret = mb_substr($ret, 0, $len - $i); 
     7            if(strlen($ret) <= $len) break; 
     8        } 
     9    } else { 
     10        $ret = $str; 
     11    } 
    312 
    4 $test= "eee<{assign_product_id}>aaaa"; 
    5 $test = ereg_replace("<{assign_product_id}>", "test", $test); 
    6 echo $test; 
     13    return $ret; 
     14} 
     15 
     16$str = "¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢¤¢"; 
     17 
     18echo sfCutStringByte($str, 100); 
    719?> 
Note: See TracChangeset for help on using the changeset viewer.