PHP.nl

iconv_substr

iconv_substr

Cut out part of a string

 **iconv_substr** string $string int $offset  $length  $encoding

Cuts a portion of specified by the and parameters. string``offset``length

stringThe original string.

offset If is non-negative, cuts the portion out of beginning at 'th character, counting from zero. offset``iconv_substr``string``offset

   If  is negative,
    cuts out the portion beginning
   at the position,  characters
   away from the end of .
  `offset``iconv_substr``offset``string`

length If is given and is positive, the return value will contain at most characters of the portion that begins at (depending on the length of ). length``length``offset``string

   If negative  is passed,
    cuts the portion out of
    from the 'th
   character up to the character that is
    characters away from the end of the string.
   In case  is also negative, the start position
   is calculated beforehand according to the rule explained above.
  `length``iconv_substr``string``offset``length``offset`

encoding If parameter is omitted or null, are assumed to be encoded in . encoding``stringiconv.internal_encoding

   Note that  and 
   parameters are always deemed to represent offsets that are
   calculated on the basis of the character set determined by
   , whilst the counterpart
    always takes these for byte offsets.
  `offset``length``encoding``substr`

Returns the portion of specified by the and parameters. string``offset``length

If is shorter than characters long, false will be returned. If is exactly characters long, an empty string will be returned. string``offset``string``offset

substr``mb_substr``mb_strcut