title: Output inconsistent when checking if first string's characters in second string php
body: <p>I'm trying to check if ALL the first string's (<code>$str1</code>) characters are in the second string (<code>$str2</code>). If all of <code>$str1</code>'s characters are in <code>$str2</code>, it should display &quot;Bingo!&quot;, if not it should display &quot;Nope :(&quot; .</p>
  <p><em><strong>Problem faced:</strong></em> My code works correctly for some examples but not for all. For instance, if both <code>$str1</code> and <code>$str2 = &quot;jenny&quot;</code>, the code displays a &quot;Nope :(&quot; when it should display &quot;Bingo!&quot; instead.</p>
  <p><em><strong>Help needed</strong></em>: I need help figuring out where the code has gone wrong and why this is happening. A suggested fix would be deeply appreciated.</p>
  <p>This is a self-submitting PHP script. Input type for both <code>$str1</code> and <code>$str2</code> are &quot;text&quot;.</p>
  <pre><code>&lt;?php
  
  if(!empty($_POST[&quot;send&quot;])){ //so that code executes when submit button with the name &quot;send&quot; is clicked
  
  $str1 = $_POST[&quot;str1&quot;];
  $str2 = $_POST[&quot;str2&quot;];
  $ch_check = [];
  
  for($i = 0; $i &lt;strlen($str1); $i++){
      $ch = $str1[$i];
      for($j = 0; $j &lt;strlen($str2); $j++){
          if($ch == $str2[$j]){
              $ch_check[] = $ch;
          }
      }
  }
  
  //echo &quot;&lt;pre&gt;&quot;;
  //var_dump($ch_check);
  //echo &quot;&lt;/pre&gt;&quot;;
  
  if(count($ch_check) == strlen($str1)){
      echo &quot;Bingo!&quot;;
  }else{
      echo &quot;Nope :(&quot;;
  }
  }
  ?&gt;
  </code></pre>