I posted this a few days ago and did not get much help;

this issue i am having is that after running the foreach loop i have a string that i split into an array in order to run a routine on. after running the foreach loop i would like to move the results in a variable outside the foreach loop for use with my code but only one chr is able to be displayed here is a copy of my code if anyone can help i would be very grateful.

session_start();
$errorMessage = '';
if (isset($POST['txtUserId']) && isset($POST['txtPassword'])) {
include 'include/config.php';
include 'include/opendb.php';
$userId = $_POST['txtUserId'];

$password = $_POST['txtPassword'];
$str = "$password";

$arr1 = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);

$arr = $arr1;

foreach ($arr as $value) {
$test=ord($value);

$test2=$test+10;

if($test2 > 122){

$test2=$test2+33;
$test2=$test2-122;

}

global $test4;

global $test4;

$test3=chr($test2);

$test4 = $test3;

}

echo $test4;

    $test2[]=$test+10;

    will create an array $test2 with the results from each $test+10, or

    $test2 .=$test+10;

    will concatanate $test

      $test2=$test+10;

      is part of my Algorithm for unencrypting my password not the array builder itself.

      if i run echo $test3; from within the foreach loop it displays the entire string but from outside the loop only the last char of the string is displayed

        Ok welll adding [] on the end af a $string will create and array and using .= will concatanate the string.

          thank you so what i need to do is concatanate the string before bringing it out of the loop correct

            Write a Reply...