Unneded number combination after replacing a number in a string.

Posted by ne5tebiu on Stack Overflow See other posts from Stack Overflow or by ne5tebiu
Published on 2010-06-16T12:19:22Z Indexed on 2010/06/16 12:22 UTC
Read the original article Hit count: 250

Filed under:
|
|

I get an unneeded number combination.

3, 4, 5, 6, 7, 8, 901234567890123456789, 30

Should be:

3, 4, 5, 6, 7, 8, 9, 10, 11, 12... (till) 30

Why that happens?

The code:

<?
ob_start(); 
$id=$_GET['id'];
if (!empty($id)){
    $id=str_replace('a9_','', $id);
    $value=$_COOKIE['NaudingasURL'];
    $exp = explode(", ", $value);
    if(in_array($id, $exp)){
        $value2=str_replace(', '.$id,"", ', '.$value);
        $value2=substr($value2, 2, strlen($value2));
        echo'r';
    }
    else{
        $value2=$value.', '.$id; echo'a';
    }
setcookie("NaudingasURL", $value2);
}
ob_end_flush();
?>

I'm calling it with Jquery ajax, but I don't thinks that's the problem.

© Stack Overflow or respective owner

Related posts about php

Related posts about number