hi guyz, i have this question like;
In ASP there is something like
what that does in ASP/VB is that it loops until the argument is falseCode:Do While arg some more codes... Loop
and i thought it should be doing the same thing with PHP's while function
but it doesn't instead it loops forever.
take this code for example;
but if i try that in PHP using the While....Loop then it loops for everCode:'Note that this is an ASP Code strPost = "[EDIT]C:\Program Files\bpmp\htdocs\smat_3.jpg[/EDIT]" Do While InStr(1, strPost, "[EDITED]", 1) > 0 AND InStr(1, strPost, "[/EDITED]", 1) > 0 'some more codes... Loop
pls note the function InStr() function,this is used to check if a given string occurs in another string and also it returns the position where the occurence starts and i have a similar php function that does that.
here it is.
PHP Code:function InStr($string,$find,$CaseSensitive = false) {
$i=0;
while (strlen($string)>=$i) {
unset($substring);
if ($CaseSensitive) {
$find=strtolower($find);
$string=strtolower($string);
}
$substring=substr($string,$i,strlen($find));
if ($substring==$find) return $i;
$i++;
}
return -1;
}





Reply With Quote