I just can't figure this out. I keep getting 'Unexpected T_String on line 3' but it looks fine to me. Oddly enough when I remove Line 1 completely I get a different error "Unexpected T_Function on line 4" ini_set('memory_limit', '99999M'); function createUrl($url,$lastnum) { $find = "?"; $trim = rtrim ($url,'a..z,A..Z,=,_,&'); $remove_to = strpbrk($trim, '?'); $number = 1; $counter= 0; while ($lastnum != $number) { $over = "?page=".$number."&"; $replace = str_replace($find,$over,$url); $myArray[$counter] = $replace; $number++; $counter++; } return $myArray; } PHP:
thanks. that wasnt the right code.. someone was trying to help me and added that in. code updated in original post: ini_set('memory_limit', '99999M'); function createUrl($url,$lastnum) { $find = "?"; $trim = rtrim ($url,'a..z,A..Z,=,_,&'); $remove_to = strpbrk($trim, '?'); $number = 1; $counter= 0; while ($lastnum != $number) { $over = "?page=".$number."&"; $replace = str_replace($find,$over,$url); $myArray[$counter] = $replace; $number++; $counter++; } return $myArray; } PHP:
I pasted the new code as is into a file, saved it and ran it from the command line with the -l (syntax check) option and got this: C:\>php -l c:\temp\t_string_error.php No syntax errors detected in c:\temp\t_string_error.php So I don't know what the problem is.
Try putting just that code in its own file and run it separately and see if you still have the problem.
Hi, I also tested that , above code is not showing up any error i think may be error is in some other file. Thanks,