php: Aus String Zeichen entfernen
-
Hallo zusammen,
ich habe $comment_program = '++++';
nun mache ich$instructions='+-.><]['; for ( $i=0; $i<strlen($comment_program); $i++ ) if ( strpos($comment_program{$i}, $instructions) ) $program .= $comment_program{$i}; echo strlen($program);
und erhalte als Ausgabe 0.
Was mache ich falsch?
Danke für alle Antworten!
-
So funzt es:
$comment_program = $_POST['program']; // delete comments for ( $i = 0; $i < strlen($comment_program); $i++ ) if ( strpos('<>.+-[]',$comment_program[$i]) ) $program .= $comment_program[$i]; echo strlen($program);