edi Posted November 19, 2009 Report Share Posted November 19, 2009 vajag izvadīt pirmo burtu no vārda $vards = "Klauns"; // vajag izvadīt tikai primo burtu (t.i K) :D Quote Link to comment Share on other sites More sharing options...
briedis Posted November 19, 2009 Report Share Posted November 19, 2009 Atbildi meklē te: http://php.net/manual/en/function.substr.php Quote Link to comment Share on other sites More sharing options...
waplet Posted November 19, 2009 Report Share Posted November 19, 2009 echo $vards[0]; Quote Link to comment Share on other sites More sharing options...
edi Posted November 19, 2009 Author Report Share Posted November 19, 2009 echo substr(''.$vards.'', 0, 1); Quote Link to comment Share on other sites More sharing options...
edi Posted November 19, 2009 Author Report Share Posted November 19, 2009 echo $vards[0]; tas arī strādā :) Quote Link to comment Share on other sites More sharing options...
briedis Posted November 19, 2009 Report Share Posted November 19, 2009 Vispār iesaku skatīties uz mb_substr (http://www.php.net/manual/en/function.mb-substr.php), ja taisies izmantot ne-latīņu burtus. mhm, paprovē vārdu "Ābece", un paskaties ko $vards[0] izvadīs :) Quote Link to comment Share on other sites More sharing options...
edi Posted November 19, 2009 Author Report Share Posted November 19, 2009 Vispār iesaku skatīties uz mb_substr (http://www.php.net/manual/en/function.mb-substr.php), ja taisies izmantot ne-latīņu burtus. mhm, paprovē vārdu "Ābece", un paskaties ko $vards[0] izvadīs :) kaut kādus kubiciņus.. iedod gatavu kodu es tur nevaru neko saprast :D Quote Link to comment Share on other sites More sharing options...
briedis Posted November 19, 2009 Report Share Posted November 19, 2009 Reāli, sliņķis tu esi. mb_substr("Vārds",0,1,"utf-8"); Quote Link to comment Share on other sites More sharing options...
waplet Posted November 19, 2009 Report Share Posted November 19, 2009 Reāli es vairs pēc tāda teikumu nepalīdzētu Quote Link to comment Share on other sites More sharing options...
rpr Posted November 19, 2009 Report Share Posted November 19, 2009 sliņķis viņš nav, viņam pietika paciesties piereģistrēties šajā forumā. Quote Link to comment Share on other sites More sharing options...
briedis Posted November 19, 2009 Report Share Posted November 19, 2009 Lābi, klasificēsim viņu par kaut kādu trolli :) Quote Link to comment Share on other sites More sharing options...
edi Posted November 19, 2009 Author Report Share Posted November 19, 2009 Reāli, sliņķis tu esi. mb_substr("Vārds",0,1,"utf-8"); man nesanāca vienkāši izvadīt pareizi no šī (string mb_substr ( string $str , int $start [, int $length [, string $encoding ]] )) :D Quote Link to comment Share on other sites More sharing options...
briedis Posted November 19, 2009 Report Share Posted November 19, 2009 Bītīt matos, varbūt apskaties lapas apakšā piemērus, izlasi komentārus? Quote Link to comment Share on other sites More sharing options...
2easy Posted November 19, 2009 Report Share Posted November 19, 2009 laikam kārtējais piektklasnieks... un kādi jautājumi panesīsies, kad php sāks kļūt populārs arī bērnudārzā? :D Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted November 19, 2009 Report Share Posted November 19, 2009 (edited) lulz. Turpmākai zināšanai: kvadrātainajās iekavās norāda optional parametrus, tie ir tādi, kas nav obligāti jānorāda. funkcijas pieraksta šādi - mb_substr($one, $two). Tātad nav jāraksta mainīgajiem priekšā to tipi, tāpat kā f-jai tās atgriežamais tips. Tajā lapā tas tiek rakstīts, lai tu zinātu kāda tipa vērtības padot f-jai un kāda tipa vērtības tā atgriezīs. fakin lasi kaut ko, nevis paskaties pirmo rindiņu, nokopē to un bļauj ka neiet Edited November 19, 2009 by rATRIJS 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.