PHP substr counts wrong -


i want 130 chars random string

$param['sec1'] = base64_encode(openssl_random_pseudo_bytes(95)); $param['sec1'] = substr($param['sec1'], 0, 130); var_dump($param['sec1']); 

and following result:

    string(128) "zrand6xjvrefta6smfp1k9c+udzabpmse6awd/1vul+2aghlbzooc0t/vlbqsv6dvjy38 d/3dkrdanng9tjjcvy3bm/occpko2amjkeantawtvt+cptgizw42fwdnte=" ["zrand6xjvrefta6smfp1k9c+udzabpmse6awd\/1vul+2aghlbzooc0t\/vlbqsv6dvjy38d\/ 3dkrdanng9tjjcvy3bm\/occpko2amjkeantawtvt+cptgizw42fwdnte=","dt+w00j2fqpwst2 vkkg55cck6thlw7pikkqreylw4u3q4fwjqagsxfrzrgl0fshbjwww9diykqdbagjlwm0kcuvjhtc 9rs62tv1tdyixnkjtc7ba4mrbbtozphpehfw=","sabufosdfs1kkhxaxggtfxo09wxeqk\/ro10 9ckktupua7dgn\/jc\/snrzt4z\/oalmdl4fu9nq0hxcvxaafkpdv3aklcqrejavybkjiptutpcu 5jo6n1kxft3tx5ggwp0="] 

var_dump says 128 chars more 128 - why that?

the part beginning ["zrand not generated code have given, code executed not shown in question.

var_dump($param['sec1']); prints out string(128) "zrand6xjvrefta6smfp1k9c+udzabpmse6awd/1vul+2aghlbzooc0t/vlbqsv6dvjy38d/3dkrdanng9tjjcvy3bm/occpko2amjkeantawtvt+cptgizw42fwdnte="


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -