Delete number in String containing a bunch of different numbers
<p>I have a String which looks like this "int1 int2 int3 int4 int5 int6 int7 int8 /<em>...</em>/ intn-1 intn" and I'm trying to delete one of the number (let's say 12 here). In order to do that, I'm currently doing something like this:</p>

<pre><code>$table = explode(' ', $my_string); 
$key = array_search($int_to_delete, $table); 
array_splice($table, $key, 1); 
$my_string = implode(' ', $table);
</code></pre>

<p>Is there a function to do that? :)
Something like "delete $needle if it's at the beginning, the end or surrounded by $delimiter (in my example ' ')" ?</p>

<p>Thx all :D</p>