Lord Posted March 9, 2011 Report Share Posted March 9, 2011 Labdien, Internetā atradu funkciju, kas izveido pēc iespējas īsāku random string - http://paste.php.lv/d88745e90d6ef147b9bc2e541acf2476?lang=php . Problēma ir tāda, ka šams neizmanto "a" . Kad ID == 1, izmantotais burts ir "b" "a" vietā, pie 63 tiek izmantots "bb" "aa" vietā. Kopumā sanāk, ka "a" netiek izmantots pie neviena ID. Varbūt kādam ir idejas, kādēļ tas tā ir? Paldies! Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 9, 2011 Report Share Posted March 9, 2011 http://snipplr.com/view/49541/randomvalue/ Pietam pašā foruma ir vismaz 20 skripti, lai to panāktu. ) Quote Link to comment Share on other sites More sharing options...
Lord Posted March 9, 2011 Author Report Share Posted March 9, 2011 Paldies par atbildi, ja neizdosies salabot esošo funkciju, meklēšu citu vai izmantošu Tavu! Varbūt ir idejas, kas varētu būt pie vainas manis atrastajai funkcijai? Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted March 9, 2011 Report Share Posted March 9, 2011 Kad ID == 0 būs arī a. Ja ID nevar būt 0, tad padod ID-1. Quote Link to comment Share on other sites More sharing options...
Lord Posted March 9, 2011 Author Report Share Posted March 9, 2011 xPtv45z, ID 0 nevar būt, pie negatīva ID izmet Error 500. Tur droši vien ir kaut kāda kļūda kodā? Quote Link to comment Share on other sites More sharing options...
m8t Posted March 10, 2011 Report Share Posted March 10, 2011 $index = " abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Quote Link to comment Share on other sites More sharing options...
Lord Posted March 10, 2011 Author Report Share Posted March 10, 2011 m8t, tā īsti nav. Šāds veids darbojas pie ID=1, bet pie ID=63 tas atkal uzliek to pašu vērtību, t.i., ID1=ID63. Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted March 10, 2011 Report Share Posted March 10, 2011 Kā jau teicu, ID vietā funkcijai padod ID-1 Quote Link to comment Share on other sites More sharing options...
Lord Posted March 10, 2011 Author Report Share Posted March 10, 2011 Izdevās, paldies. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.