note 61458 modified in function.substr by danbrown

From: Date: Fri, 28 Nov 2008 20:21:13 +0000
Subject: note 61458 modified in function.substr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147202@lists.php.net to get a copy of this message
Here's a function I wrote that'll insert a string into another string with an offset. <?php // $insertstring - the string you want to insert // $intostring - the string you want to insert it into // $offset - the offset function str_insert($insertstring, $intostring, $offset) { $part1 = substr($intostring, 0, $offset); $part2 = substr($intostring, $offset); $part1 = $part1 . $insertstring; $whole = $part1 . $part2; return $whole; } ?> --was-- Here's a function I wrote that'll insert a string into another string with an offset. // $insertstring - the string you want to insert // $intostring - the string you want to insert it into // $offset - the offset function str_insert($insertstring, $intostring, $offset) { $part1 = substr($intostring, 0, $offset); $part2 = substr($intostring, $offset); $part1 = $part1 . $insertstring; $whole = $part1 . $part2; return $whole; } http://php.net/manual/en/function.substr.php

« previous php.notes (#147202) next »