sam06 Posted August 17, 2009 Share Posted August 17, 2009 Any idea why I'm getting "parse error" for this on the echo implode... line? <?php $c = 50000; $m = (int)((sqrt($c))+1); $p = array_fill(2, $c-1, 1); $i = 2; while ($i<$m) { $j=$i*2; while($j<$c+1) { $p[$j] = 0; $j += $i; } $i++; } echo implode(’ ‘,array_keys($p, 1)); ?> Many thanks. Sam Link to comment https://forums.phpfreaks.com/topic/170618-parse-error-in-sieve-of-eratosthenes/ Share on other sites More sharing options...
DarkendSoul Posted August 17, 2009 Share Posted August 17, 2009 It looks like your using some sort of non-standard quotes... <?php $c = 50000; $m = (int)((sqrt($c))+1); $p = array_fill(2, $c-1, 1); $i = 2; while ($i<$m) { $j=$i*2; while($j<$c+1) { $p[$j] = 0; $j += $i; } $i++; } echo implode(' ',array_keys($p, 1)); ?> Are you using M$ Word or OpenOffice as a text editor? They tend to make your printed documents prettier by replacing quotes with special ones. For coding I would suggest using something like Notepad++ -> http://notepad-plus.sourceforge.net/uk/site.htm Link to comment https://forums.phpfreaks.com/topic/170618-parse-error-in-sieve-of-eratosthenes/#findComment-899913 Share on other sites More sharing options...
GingerRobot Posted August 17, 2009 Share Posted August 17, 2009 Are you using M$ Word or OpenOffice as a text editor? Yeah, they look like MS "smart" quotes. Link to comment https://forums.phpfreaks.com/topic/170618-parse-error-in-sieve-of-eratosthenes/#findComment-899919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.