pow Posted July 18, 2014 Report Posted July 18, 2014 (edited) / Edited September 26, 2016 by pow Quote
zekstein Posted July 18, 2014 Report Posted July 18, 2014 (edited) <?php$string = "CAPCA P [P] [P] PPP";echo 'Before : '.$string.' !';$split = str_split( $string );foreach( $split as $k => $v ){ if( $v == "P" ) { $start = 0; $finish = 0; for( $i = $k; $i >= 0; $i-- ) if( $split[$i] == "[" ) { $start = 1; break; } for( $i = $k; $i < strlen( $string ); $i++ ) if( $split[$i] == "]" ) { $finish = 1; break; } if( $start != 1 || $finish != 1 ) $split[$k] = ""; }}$da = "";foreach( $split as $k => $v ) $da .= $v;echo '<br>After: '.$da.' !';?>Before : CAPCA P [P] [P] PPP !After: CACA [P] [P] !Nu stiu daca este exact ceea ce doresti, dar sper sa iti faci o idee. Edited July 18, 2014 by zekstein 1 Quote
pow Posted July 18, 2014 Author Report Posted July 18, 2014 (edited) / Edited September 26, 2016 by pow Quote
zekstein Posted July 18, 2014 Report Posted July 18, 2014 Poti sa imi arati un string pe care sa pot face teste?Mi-ar fi mai usor. Quote
pow Posted July 18, 2014 Author Report Posted July 18, 2014 (edited) / Edited September 26, 2016 by pow Quote
zekstein Posted July 18, 2014 Report Posted July 18, 2014 Nu inteleg mare lucru Poti bolduii diferentele ?Daca nu primesti raspuns pana maine, incerc eu ceva.Momentan am uptime-ul prea mare. Quote
pow Posted July 18, 2014 Author Report Posted July 18, 2014 (edited) / Edited September 26, 2016 by pow Quote