Does exist a function to insert a string into another one?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • francescomoi@europe.com

    Does exist a function to insert a string into another one?

    Hi.

    I wonder wether this function exists or not:
    insertstr($stri ng1, $string2, $position)

    This function inserts 'string1' into 'string2' at 'position'.
    If it exists, ok. If not, I'll write it by myself.

    Regards.

  • Chris Hope

    #2
    Re: Does exist a function to insert a string into another one?

    francescomoi@eu rope.com wrote:
    [color=blue]
    > I wonder wether this function exists or not:
    > insertstr($stri ng1, $string2, $position)
    >
    > This function inserts 'string1' into 'string2' at 'position'.
    > If it exists, ok. If not, I'll write it by myself.[/color]

    $foo = substr_replace( 'abcdefg', '123', 3, 0);

    Result: $foo => abc123defg



    --
    Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

    Comment

    Working...