Advertisement
saiful_islam01

Untitled

Nov 21st, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. $fruites = array('Mango', 'apple', 'banana', 'orange','plum', 'lime');
  4.  
  5.  
  6. foreach( $fruites as $key=>$value){
  7.  
  8.  
  9. if(strlen($value) >= 5 && strlen($value)<=10){
  10. $fruites[$key] = array( $value, 'valid'=>1);
  11. }else{
  12. $fruites[$key] = array( $value, 'valid'=> 0 );
  13. }
  14.  
  15. }
  16.  
  17. echo "<pre>";
  18. print_r($fruites);
  19. echo "</pre>";
  20.  
  21.  
  22. foreach ($fruites as $arr){
  23. if($arr['valid']){
  24. echo "<br>";
  25. echo $arr[0]. " is valid";
  26. } else {
  27. echo "<br>";
  28. echo $arr[0]. " is non valid";
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement