Hamlets Posted June 7, 2006 Report Share Posted June 7, 2006 Gribu no $x izgriest to kas ir starp "<small>" līdz "---" Bet tikai sākumā, tas ir vienu reizi... Ar kādu funkciju to varētu izdarīt? Mēģināju k-ko ar explode, bet k-kas nesanāca... Link to comment Share on other sites More sharing options...
v3rb0 Posted June 7, 2006 Report Share Posted June 7, 2006 (edited) $x = '<small> es te biju--- un te arii</small>'; preg_match('/\<small\>(.*)\-{3}/',$x, $m); echo $m[1]; ja jautājumu pareizi sapratu.. Edited June 7, 2006 by v3rb0 Link to comment Share on other sites More sharing options...
Hamlets Posted June 7, 2006 Author Report Share Posted June 7, 2006 v3rb0, nē k-kas neiet kā vajadzētu :( $x= explode("<small>",$x); $x = $x[1]; $text = explode("---",$x); $x = $x[2]; Tā varbūt? Link to comment Share on other sites More sharing options...
Vebers Posted June 7, 2006 Report Share Posted June 7, 2006 Ja pareizi sapratu, tad: $text='<small>Es te biju --- un te arī</small>'; $start= explode("<small>",$text); $text = explode("---",$start[1]); echo $text[0]; Link to comment Share on other sites More sharing options...
Hamlets Posted June 8, 2006 Author Report Share Posted June 8, 2006 MakaTaNaw, vispār jau vajadzēja parādit to kas paliek pāri pēc izgrišanas, bet es tavu pārtaisīju šādi $text=$x; $start= explode("<small>",$text); $text = explode("---",$start[1]); echo $text[1]; Bet tas izgrieza visus <small> starp ---, bet vajadzēja tikai pirmo... Link to comment Share on other sites More sharing options...
Hamlets Posted June 8, 2006 Author Report Share Posted June 8, 2006 PIEMĒRS Vajag """" Hamlets gāja pa mežu un ieraudzīja <small> džeku kurš dejoja ar meiteni --- un bija laimīgs, ka viņi ir laimīgi, viņi, tas ir džeks <small> un meitene ---!"""" Pārveidot uz """"Hamlets gāja pa mežu un ieraudzīja un bija laimīgs, ka viņi ir laimīgi, viņi, tas ir džeks <small> un meitene ---!"""" Link to comment Share on other sites More sharing options...
v3rb0 Posted June 8, 2006 Report Share Posted June 8, 2006 (edited) $x = preg_replace('/\<small\>[^\-]+\-{3}/','',$x,1); Edited June 8, 2006 by v3rb0 Link to comment Share on other sites More sharing options...
Hamlets Posted June 8, 2006 Author Report Share Posted June 8, 2006 (edited) Itkā sanāca :) Edited June 8, 2006 by Hamlets Link to comment Share on other sites More sharing options...
Recommended Posts