loop through string using PHP

/ Published in: PHP
Save to your folder(s)

Simple PHP for loop to display / check each character within a string variable.

Copy this code and paste it in your HTML
  1. $string = "Your String";
  2. for($i=0;$i<strlen($string);$i++){
  3. $char = substr($string,$i,1);
  4. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.