Sasa Posted May 5, 2007 Report Share Posted May 5, 2007 Kā varēja saskaitīt cik daudz ierakstu failā, ja katrs nākamais ieraksts ir zem iepriekšējā? zinu tādu funkciju count(), bet kas ir jāizdara pa preikšu? Link to comment Share on other sites More sharing options...
Roze Posted May 5, 2007 Report Share Posted May 5, 2007 <? echo count(file('fails.txt')); ?> vai <? echo substr_count(file_get_contents('fails.txt'),"\n"); ?> Link to comment Share on other sites More sharing options...
Sasa Posted May 5, 2007 Author Report Share Posted May 5, 2007 kapē man PHP neļauj šādi darī trim($files_arr[$i],".jpg",".png",".bmp",",jpeg",".gif"); PS. Paldies par ierakstu sitīšanu strādā! Link to comment Share on other sites More sharing options...
bubu Posted May 5, 2007 Report Share Posted May 5, 2007 Tāpēc, ka vajag apskatīties dokumentāciju: http://lv2.php.net/trim Tur skaidri un gaiši parādīta funkcijas trim apraksts: string trim ( string $str [, string $charlist] ) Acīmredzot tur var padot vai nu vienu, vai arīdivus argumentus. A bet tu padod cik? - veselus 6 gabalus! Link to comment Share on other sites More sharing options...
Roze Posted May 5, 2007 Report Share Posted May 5, 2007 kapē man PHP neļauj šādi darī trim($files_arr[$i],".jpg",".png",".bmp",",jpeg",".gif"); Ko tu ar to kodu gribi panākt? Man izskatās ka trim() funkcija tiek ar kaut ko jaukta / izmantota tam kam nav paredzēta .. Link to comment Share on other sites More sharing options...
Sasa Posted May 6, 2007 Author Report Share Posted May 6, 2007 es no tā mainīgā gribu iztrimēt visas tās vērtibas ja tur tādas ir! Bet šķiet ka trim var izmantot tikai ar vienu! Link to comment Share on other sites More sharing options...
Delfins Posted May 6, 2007 Report Share Posted May 6, 2007 (edited) Izmanto kādu ereg/preg-replace Edited May 6, 2007 by Delfins Link to comment Share on other sites More sharing options...
Sasa Posted May 6, 2007 Author Report Share Posted May 6, 2007 kā, lai sataisa tā lai nevar tukšu postu pievienot? Link to comment Share on other sites More sharing options...
peehaa Posted May 6, 2007 Report Share Posted May 6, 2007 if(empty($posts)) { // tukshs } else { // pilns } ? Link to comment Share on other sites More sharing options...
Recommended Posts