tiy Posted March 21, 2006 Report Share Posted March 21, 2006 Vai ir kaut kada f-ja, kas nosaka stringa lielumu bytes piem($a="aaaaaaaaaaaaaaaa"), kaut kas lidzigs filesize. Link to comment Share on other sites More sharing options...
Blitz Posted March 21, 2006 Report Share Posted March 21, 2006 (edited) vai tad nav taa ka viens simbols aiznem 1 byte? Tad izmanto strlen... Edited March 21, 2006 by Blitz Link to comment Share on other sites More sharing options...
tiy Posted March 21, 2006 Author Report Share Posted March 21, 2006 (edited) Enters cik aiznem? \n bus jau 2 byte, bet ka simbols ir 1 byte ? Edited March 21, 2006 by tiy Link to comment Share on other sites More sharing options...
v3rb0 Posted March 21, 2006 Report Share Posted March 21, 2006 <?php echo 'enters aiznem '.strlen("\n").'!';?> Link to comment Share on other sites More sharing options...
tiy Posted March 21, 2006 Author Report Share Posted March 21, 2006 $string="abc\n"; $kb = round(strlen($string)/1024,3); echo $kb.'Kb'; es domaju tema slegta, Paldies. Link to comment Share on other sites More sharing options...
bubu Posted March 21, 2006 Report Share Posted March 21, 2006 \n bus jau 2 byte, bet ka simbols ir 1 byte ? Muļķības. \n vienmēr aizņem 1 baitu. Taču enters windows/dos vidē pierakstās kā \r\n. No turienes arī ir tie 2 baiti. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 21, 2006 Report Share Posted March 21, 2006 daudzkas atkariigs arii no kodeejuma... garie, mikstinaajuma zimes utt var aiznjemt arii vairaak par 1 baitu... Link to comment Share on other sites More sharing options...
GedroX Posted March 21, 2006 Report Share Posted March 21, 2006 Cik man nācies sastapties, strlen('ā') == 2. Ļoti nepatīkami, kad nākās 'apgriezt' kādu tekstu (100 pirmos simbolus, piemēram) un trāpi tieši uz UTF simbola pa vidam. :) Link to comment Share on other sites More sharing options...
v3rb0 Posted March 21, 2006 Report Share Posted March 21, 2006 mb_* f-jas tādām darbībam domātas. ja mb_* f-jas nav, bet ir pajauns mysql, tad var ar mysql left() f-ju apgriezt pa veseliem burtiem. Link to comment Share on other sites More sharing options...
Recommended Posts