title: How to encrypt string without mcrypt library in php
body: <p>in function need key to encrypt string  without mcrypt libraly in php</p>
  
  <pre><code>function encrypt($str, $pass){
          $str_arr = str_split($str);
          $pass_arr = str_split($pass);
          $add = 0;
          $div = strlen($str) / strlen($pass);
          while ($add &lt;= $div) {
               $newpass .= $pass;
               $add++;
          }
          $pass_arr = str_split($newpass);
          foreach($str_arr as $key =&gt;$asc) {
              $pass_int = ord($pass_arr[$key]);
              $str_int = ord($asc);
              $int_add = $str_int + $pass_int;
              $ascii .= chr($int_add);
          }
          return $ascii;
      }
  
      function decrypt($enc, $pass){
          $enc_arr = str_split($enc);
          $pass_arr = str_split($pass);
          $add = 0;
          $div = strlen($enc) / strlen($pass);
          while ($add &lt;= $div) {
              $newpass .= $pass;
              $add++;
          }
          $pass_arr = str_split($newpass);
          foreach($enc_arr as $key =&gt;$asc) {
              $pass_int = ord($pass_arr[$key]);
              $enc_int = ord($asc);
              $str_int = $enc_int - $pass_int;
              $ascii .= chr($str_int);
          }
          return $ascii;
      }
  </code></pre>
  
  <p>in this not work for i character i test it</p>