3v4l.org

run code in 300+ PHP versions simultaneously
<?php $student_comment_new = 'PDI+PEwuMDIwMzEwNDAwODAtVC01UC01PlJvbiBDb21tZW50IDI8ZS4yPg=='; $fixed = base64_decode($student_comment_new); echo $fixed . "\n\n"; //Decode the entire comment $comment_cltxt = base64_decode($student_comment_new); echo $comment_cltxt . "\n\n"; //get the comment number. $comment_nr = explode('><L.', $comment_cltxt)[0]; $comment_nr = explode('<', $comment_nr)[1]; //get the comment end-text $comment_nr_string = '<' . $comment_nr . '>'; $comment_end_string = '<e.' . $comment_nr . '>'; echo $comment_nr . "\n"; echo $comment_nr_string . "\n"; echo $comment_end_string . "\n"; //get the comment text itself $pos1 = substr($comment_cltxt, 0, strlen(comment_nr_string)); $pos2 = substr($comment_cltxt, strlen($comment_cltxt) - strlen($comment_end_string)); $comment_text = substr($comment_cltxt, $pos1, $pos2); echo $comment_text . "\n";

preferences:
55.67 ms | 402 KiB | 5 Q