Re: Script feedback: insert string into another string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tijnema! Thanks for the quick reply! I really really really appreciate the help. :D

Tijnema ! wrote:
Nice idea, but it seems that it isn't working correctly. I did this example:
<?php
for($x = 0; $x < 100; $x++) { $string .= " abc"; }
echo break_up($string, 10, "||");
?>
With your break_up function. It results this:
...<snip>...
While i expected this:
...</snip>...

Ahhhhhh! Great way to test this!

I thought I noticed a problem, but did not put two-and-two together due to the huge string I was using... The way you simplified things really made that error clear. Thanks for the help on this! :)

And i found where the problem is, it is this line:
$num += $num; // Set next number flag to look for.
This works only for one time, but after that, it doubles whole time,
so in above example, $num would go like this:
10
20
40
80

Doh! Great catch! I should have printed that var out... Hehe, I am such a noob!

So to fix, replace this part of the code:
...<snip>...
with this:
...<snip>...
That's it.

Woot! Looks good to me. I moved the script to a new location with a more fitting name:

<http://www.ambiguism.com/sandbox/insert/insert.php>

Your test code is at bottom of that page. ;)

Nice, I am stoked! Thanks again for the help, I owe you one. :D

Have a great day/night,
Cheers,
Micky


--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux