How to make a string of an string array in php? -


i facing following issue. there array contaning several strings. we'd append eachother together. implode function seems solution.

here detailed data in array:

0   -----begin encrypted private key-----\n  1   miicxjbabgkqhkig9w0bbq0wmzabbgkqhkig9w0bbqwwdgqir9as3yoyqiscagga\n   2   mbqgccqgsib3dqmhbajr2e4ed62llqscaodorzp66bntaznbhoyrrzpoyoxhbug4\n   3   ah/505qbwe+slgsnp1gys+mgrbmc6ocv6o+gubmzx/ovhhzee08cqi/a5v4ndyns\n   4   i+v8c9nydepyvsppqhswyea8zqerqbpkzupg2pcrcsmixc0hfuk+2z8q1c6rtmnq\n   5   jyqk7jpo+nnug+xeeetwt02g9vypo2f8nkcqq3oskdxmugyzbirfmmf9cyb5rub2\n   6   qcwgbi1bb+28eozev8sabogfof7svc1o4iy/n0e/qpl67upumdjei5pfdkoqpmyq\n   7   g9wbehpmr/xtqcyhhilfwi5a8bpgb/iounxuryurvg6eiu/ujpyjagod7lhzkvb5\n   8   n8sya94mbdt21oprjov8zcgnd4l9wcy9fk3kkwoxm1ofw4y+lxrcibkzy2dzf5uc\n   9   8kicm/25jbucvkfvuea8siazj7v9budnwaspqfae/xmmoj5rgzxelen/a28je+vz\n   10  mfmia2ndtsbxfxdtdxnrchag2c35wau/hxlo427cci1corydtunnpeumsgiy6cmw\n   11  tcg4mycapdfnsiwgvwpsj/hyeoicdr/q7+apu32dc4jf6/r6gv0itgdinu4wxany\n   12  hpjreel6g/ndfd6lwiyibdjp4jhvcuwgegdxubfkhqjvx+8xzjayw+sfyxqifuzd\n   13  fyyv0por8f7fidnc32zifqpydz/sproty0fsnglcuc1l0hx44e9t8bg9f+lm9jpd\n   14  1me4sg+xkf9qbaudgtivk/qqck1filyro4t/6hcu9z1+7zexxqi2d/d8loitztgs\n   15  w2f8oaoxov5q5d9x/bneb+8fpnwdacvmw9ntvlabji0vo3ew+xhj8tyd\n   16  -----end encrypted private key-----\n    

the result wish this:

-----begin encrypted private key-----\nmiicxjbabgkqhkig9w0bbq0wmzabbgkqhkig9w0bbqwwdgqir9as3yoyqiscagga\nmbqgccqgsib3dqmhbajr2e4ed62llqscaodorzp66bntaznbhoyrrzpoyoxhbug4\nah/505qbwe+slgsnp1gys+mgrbmc6ocv6o+gubmzx/ovhhzee08cqi/a5v4ndyns\ni+v8c9nydepyvsppqhswyea8zqerqbpkzupg2pcrcsmixc0hfuk+2z8q1c6rtmnq\njyqk7jpo+nnug+xeeetwt02g9vypo2f8nkcqq3oskdxmugyzbirfmmf9cyb5rub2\nqcwgbi1bb+28eozev8sabogfof7svc1o4iy/n0e/qpl67upumdjei5pfdkoqpmyq\ng9wbehpmr/xtqcyhhilfwi5a8bpgb/iounxuryurvg6eiu/ujpyjagod7lhzkvb5\nn8sya94mbdt21oprjov8zcgnd4l9wcy9fk3kkwoxm1ofw4y+lxrcibkzy2dzf5uc\n8kicm/25jbucvkfvuea8siazj7v9budnwaspqfae/xmmoj5rgzxelen/a28je+vz\nmfmia2ndtsbxfxdtdxnrchag2c35wau/hxlo427cci1corydtunnpeumsgiy6cmw\ntcg4mycapdfnsiwgvwpsj/hyeoicdr/q7+apu32dc4jf6/r6gv0itgdinu4wxany\nhpjreel6g/ndfd6lwiyibdjp4jhvcuwgegdxubfkhqjvx+8xzjayw+sfyxqifuzd\nfyyv0por8f7fidnc32zifqpydz/sproty0fsnglcuc1l0hx44e9t8bg9f+lm9jpd\n1me4sg+xkf9qbaudgtivk/qqck1filyro4t/6hcu9z1+7zexxqi2d/d8loitztgs\nw2f8oaoxov5q5d9x/bneb+8fpnwdacvmw9ntvlabji0vo3ew+xhj8tyd\n-----end encrypted private key----- 

the code have looks this.

$arr = array(); ... $arr = $dataweloaded; $string = implode($arr); 

now interesting thing..

my real output not described above. contains 1024 bytes.

-----begin encrypted private key-----\nmiicxjbabgkqhkig9w0bbq0wmzabbgkqhkig9w0bbqwwdgqir9as3yoyqiscagga\nmbqgccqgsib3dqmhbajr2e4ed62llqscaodorzp66bntaznbhoyrrzpoyoxhbug4\nah/505qbwe+slgsnp1gys+mgrbmc6ocv6o+gubmzx/ovhhzee08cqi/a5v4ndyns\ni+v8c9nydepyvsppqhswyea8zqerqbpkzupg2pcrcsmixc0hfuk+2z8q1c6rtmnq\njyqk7jpo+nnug+xeeetwt02g9vypo2f8nkcqq3oskdxmugyzbirfmmf9cyb5rub2\nqcwgbi1bb+28eozev8sabogfof7svc1o4iy/n0e/qpl67upumdjei5pfdkoqpmyq\ng9wbehpmr/xtqcyhhilfwi5a8bpgb/iounxuryurvg6eiu/ujpyjagod7lhzkvb5\nn8sya94mbdt21oprjov8zcgnd4l9wcy9fk3kkwoxm1ofw4y+lxrcibkzy2dzf5uc\n8kicm/25jbucvkfvuea8siazj7v9budnwaspqfae/xmmoj5rgzxelen/a28je+vz\nmfmia2ndtsbxfxdtdxnrchag2c35wau/hxlo427cci1corydtunnpeumsgiy6cmw\ntcg4mycapdfnsiwgvwpsj/hyeoicdr/q7+apu32dc4jf6/r6gv0itgdinu4wxany\nhpjreel6g/ndfd6lwiyibdjp4jhvcuwgegdxubfkhqjvx+8xzjayw+sfyxqifuzd\nfyyv0por8f7fidnc32zifqpydz/sproty0fsnglcuc1l0hx44e9t8bg9f+lm9jpd\n1me4sg+xkf9qbaudgtivk/qqck1filyro4t/6hcu9z1+7zexxqi2d/d8loitztgs\nw2f8oaoxov5q5d9x/bneb+8fpnwdacvmw9ntvlabji0vo3ew+xhj8tyd\n-----end encrypted      

if compare string, should realise few bytes missing! current output should have been appended private key-----\n hence part in last element of array, result in -----end encrypted private key-----.

i achieve -----end encrypted .

i thought heap memory limitations. php.ini sais 256mb reserved. read variables can 2gb large. should not problem in here.

implode() should fine, because of fact other funcitons file_get_contents() return identical wrong result.

reading code line in following:

function readline($file){     $string = null;     $handle = fopen($file, "r");     if ($handle) {         while (($line = fgets($handle)) !== false) {             $string .= $line;         }         fclose($handle);     } return $string; } 

i kept searching mistake long time. tracing calls inside of debugger made possible recognize fix size of 1024 bytes in every case, no mattre method used.

have ever experienced such abnormal behavior? hope not easy , missing important.

the resulting string should contain exact same data in array elements.

there seems serious problem debugger utility used. here image shows phenomen. highly assume 1024 bytes presented in variable content viewer in debug mode. code well, php isn't fault =)

there no real problem in before.

enter image description here


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -