forgetabout Posted October 24, 2006 Report Share Posted October 24, 2006 Ir piem. 66.98.238.8:3128 204.11.237.113:80 Tātad, ja tas ir masīvā $proxy, kā man tagad atdalīt šādi masīvā $ip to kas pirms : un $port to kas pēc :. Nekas jēdzīgs man ar to foreach nesanāca :( Link to comment Share on other sites More sharing options...
hmnc Posted October 24, 2006 Report Share Posted October 24, 2006 foreach $array as $one $parts = explode(':',$one); Link to comment Share on other sites More sharing options...
andrisp Posted October 24, 2006 Report Share Posted October 24, 2006 (edited) Es darītu šādi: $arr = array(); foreach($proxy as $v) { $arr[] = explode(':', $v); } print_r($arr); Edited October 24, 2006 by andrisp Link to comment Share on other sites More sharing options...
forgetabout Posted October 24, 2006 Author Report Share Posted October 24, 2006 Nu, bet nesanāk tas ko vajadzēja :/ Link to comment Share on other sites More sharing options...
v3rb0 Posted October 24, 2006 Report Share Posted October 24, 2006 foreach($proxy as $v) list($ips[], $ports[]) = explode(':', $v); print_r($ips); print_r($ports); Link to comment Share on other sites More sharing options...
andrisp Posted October 24, 2006 Report Share Posted October 24, 2006 (edited) Ko nozīmē "nesanāca" ? Dīvainu masīvu izdod ? Kļūdas paziņojums ? Tev $proxy vispār ir masīvs ? UPD: Tev droši vien tas $proxy nemaz nav masīvs, vispirms izdari šādi: $proxy = explode('\n', $proxy); Edited October 24, 2006 by andrisp Link to comment Share on other sites More sharing options...
forgetabout Posted October 24, 2006 Author Report Share Posted October 24, 2006 andrisp, prasīju taču, lai pēc tam ir ip masīvā $ip un ports - $ports. Link to comment Share on other sites More sharing options...
andrisp Posted October 24, 2006 Report Share Posted October 24, 2006 Ahh sorry, neievēroju. Tad izmanto v3rb0 variantu ar list. Link to comment Share on other sites More sharing options...
hmnc Posted October 25, 2006 Report Share Posted October 25, 2006 ko nozīmē prasīji? tev pašam smadzeņu nav, ka mums tavā vietā jādomā? gan es gan andrisp pameta reālus piemērus kā dabūt ārā visu ko tev vajag - pārējo pielāgo savām vajadzībām Link to comment Share on other sites More sharing options...
Recommended Posts