Jump to content

Issue with 2


holladb

Recommended Posts

I have a variable being sent over and i need to grab the first 2 characters...i've tried a couple different things but nothing seems to work. Here is what i had last:

 

$code1 = $_POST['code1'];
$a = count_chars($code1, 2);
foreach (count_chars($code1,1) as $i => $val) {
   $item .= chr($i).",";
}	
//$item = sort($item);
$c = array($item);
echo $c;
echo $item;
//echo "<b>".$1."<b>".$2;
echo $a;

 

Now this way works in the sense that it puts it in an array and i will be able to explode it and list each variable but it mixes up the format. For instance if the post variable of code1 was AB12 it would put 21ba. So that wont work.

 

Anybody have a solution??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.