sepoto Posted November 3, 2010 Share Posted November 3, 2010 At this point I think I am willing to pay for the answer. My strpos does not work. My echo does not work. I can't even create my own strpos. My program is ignoring charachters that clearly exist before my very eyes in my debugger.<?php$cnt = strlen($book); for($int=0;$int<$cnt;++$int){ echo $book[$cnt];}?> Link to comment Share on other sites More sharing options...
[dx] Posted November 3, 2010 Share Posted November 3, 2010 Try:for($int=0;$int<$cnt;$int++) Link to comment Share on other sites More sharing options...
jeffman Posted November 3, 2010 Share Posted November 3, 2010 Haris_S should study the difference between $i++ and ++$i .@Sepoto: Without looping, have you verified that your version of PHP supports character indexing of strings? It should be easy enough to do:$str = "Hello";echo $str[1];// should echo 'e'Are you certain that echo itself even works? Link to comment Share on other sites More sharing options...
thescientist Posted November 3, 2010 Share Posted November 3, 2010 what is $book?add echo phpinfo() at the start of your page and verify what version of PHP you are running. Link to comment Share on other sites More sharing options...
trevelluk Posted November 3, 2010 Share Posted November 3, 2010 for($int=0;$int<$cnt;++$int){echo $book[$cnt];}Shouldn't that be echo $book[$int] Link to comment Share on other sites More sharing options...
justsomeguy Posted November 3, 2010 Share Posted November 3, 2010 Shouldn't that be echo $book[$int]Good catch. I didn't even notice that. Link to comment Share on other sites More sharing options...
sepoto Posted November 3, 2010 Author Share Posted November 3, 2010 I am not certaun at all. In fact I don't think that it does. Is there a remedy? Haris_S should study the difference between $i++ and ++$i .@Sepoto: Without looping, have you verified that your version of PHP supports character indexing of strings? It should be easy enough to do:$str = "Hello";echo $str[1];// should echo 'e'Are you certain that echo itself even works? Link to comment Share on other sites More sharing options...
sepoto Posted November 3, 2010 Author Share Posted November 3, 2010 You are right! I will get on to fix that right now. Incedentally I finally got strpos working but I do not know how or why it is working now but it did not work before yet. It is as if it magically just started working after I replaced a few charachters in the text file. Good catch. I didn't even notice that. Link to comment Share on other sites More sharing options...
ShadowMage Posted November 3, 2010 Share Posted November 3, 2010 You are right! I will get on to fix that right now. Incedentally I finally got strpos working but I do not know how or why it is working now but it did not work before yet. It is as if it magically just started working after I replaced a few charachters in the text file.Did you look at the answers in your other post?BTW, just out of curiosity, why did you post three different topics on essentially the same issue? (One being this topic, one being the one I linked above, and the other is here) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.