Sephy Posted April 18, 2008 Report Share Posted April 18, 2008 ir kada komanda ar ko var kadu skaitlu virkni parveidot binari(piemeram 3432432432 uz 00110001(piemers nepareizs ;D)). ja nav tad iedodiet kadu skipteli kas parveido binari ;P Link to comment Share on other sites More sharing options...
Aleksejs Posted April 18, 2008 Report Share Posted April 18, 2008 http://lv.php.net/manual/en/function.decbin.php Link to comment Share on other sites More sharing options...
Sephy Posted April 18, 2008 Author Report Share Posted April 18, 2008 man te error ;[ reku mana funkcija: <?php $ciparz = "13337"; //cipars ko vajag parveidot echo "cipar test $ciparz"; //////////////parveidojam pa binari//////////////////////// function needbinary($binarais){ $binari=decbin($ciparz); } echo "binarajaa kodaa tavs cipars bus $binarais"; //izvada binaro ciparu ;D ?> Link to comment Share on other sites More sharing options...
Aleksejs Posted April 18, 2008 Report Share Posted April 18, 2008 (edited) Un KĀDS tas error ir?! :@ Tu jau to funkciju nevienā vietā neizsauc! Edited April 18, 2008 by Aleksejs Link to comment Share on other sites More sharing options...
andrisp Posted April 18, 2008 Report Share Posted April 18, 2008 Protams, tu jau to funkciju nemaz neizsauc. un prichom tev vispaar veidot to needbinary ? Link to comment Share on other sites More sharing options...
Sephy Posted April 18, 2008 Author Report Share Posted April 18, 2008 Protams, tu jau to funkciju nemaz neizsauc. un prichom tev vispaar veidot to needbinary ? a ja nu man bus vairak nekaa viens cipars(kadi 10 piemeram) es gribetu lai ar manu funkciju vinus var aprevidot nevis katru reizi raxtot decbin ;P Link to comment Share on other sites More sharing options...
andrisp Posted April 18, 2008 Report Share Posted April 18, 2008 nu bet tā tava mega funkcija tāpat ņem pretī tikai vienu ciparu. :) bet nu labi tas nav svarīgi. problēma jau ir citur. Link to comment Share on other sites More sharing options...
Sephy Posted April 18, 2008 Author Report Share Posted April 18, 2008 ai nu labi iztikshu bez funkcijas ;D. raxtishu katram ciparam atsevishki parveidi ;P Link to comment Share on other sites More sharing options...
Sephy Posted April 18, 2008 Author Report Share Posted April 18, 2008 nakamais jautajums: es parveidoju kautkadu tur ciparu 133337 un iznak 10000100101010001. man vajag izgriezt takaa 1,2,4,8,16 utt(nu tipa 2npakapee) un noglabat teksts failaa kaa to varetu dabut gatavu ;P?! Link to comment Share on other sites More sharing options...
andrisp Posted April 18, 2008 Report Share Posted April 18, 2008 ko tev vajag izgriezt ? nesapratu. Link to comment Share on other sites More sharing options...
Sephy Posted April 18, 2008 Author Report Share Posted April 18, 2008 man vajag izgriezt no 101010000110001 skaitlus kas ir 2n pakapee. tatad man vajag izgriezt 1 skaitli(kas ir 20=1), 2 skaitlis(kas ir 21=2) un kaa arii 4,8,16,32,64 utt. shajaa gadijumaa izgrieztaa virkne bus 0001!! nu text failee es vinu maceshu saglabat ;D Link to comment Share on other sites More sharing options...
bubu Posted April 18, 2008 Report Share Posted April 18, 2008 No stringa i-to simbolu māki dabūt? Link to comment Share on other sites More sharing options...
Sephy Posted April 18, 2008 Author Report Share Posted April 18, 2008 (edited) hmm nezinu laikam jau nee ;D. hmm un man vispaar nevajag parveidot visu 1337 uz 01001000101 bet gan sitaa 1=0 3=1 3=1 7=0 un galaa dabut shajaa gadijumaa 0110 ;P Edited April 18, 2008 by Sephy Link to comment Share on other sites More sharing options...
gurkjis Posted April 18, 2008 Report Share Posted April 18, 2008 tev laikam derēs strrev() funkcija Link to comment Share on other sites More sharing options...
bubu Posted April 18, 2008 Report Share Posted April 18, 2008 bet gan sitaa 1=0 3=1 3=1 7=0 un galaa dabut shajaa gadijumaa 0110 ;P wtf? Link to comment Share on other sites More sharing options...
Recommended Posts