andrisp Posted May 13, 2005 Report Share Posted May 13, 2005 $ko = ":02.jpg:"; $kur = ":02.jpg:05.jpg:x01.jpg:"; if (strpos($kur, $ko)) { echo "jaa"; } else { echo "nee"; } nezkapeec neatrod.. tipa "nee"; iedomaajos, ka varbuut taapeec, ka iespeejams, ka strpos varbuut saak mekleet no adreses 1, kas reaali ir ir simbols 2.. kas tur iisti ir par probleemu ? Link to comment Share on other sites More sharing options...
Venom Posted May 13, 2005 Report Share Posted May 13, 2005 if (strpos($kur, $ko)!==false) jo :02.jpg sākas no 0-tās pozīcijas, resp. sanāk if (0), kas tiek pārkonvertēts par false uzmanīgi Link to comment Share on other sites More sharing options...
рпр Posted May 13, 2005 Report Share Posted May 13, 2005 taapeec, ka atgriezj 0, bet 0 == false vajag paarbaudiit if (strpos()>=0) Link to comment Share on other sites More sharing options...
andrisp Posted May 13, 2005 Author Report Share Posted May 13, 2005 paldies.. buushu uzmaniigaaks :) Link to comment Share on other sites More sharing options...
rudzis Posted May 13, 2005 Report Share Posted May 13, 2005 $ko = ":02.jpg:"; $kur = ":02.jpg:05.jpg:x01.jpg:"; if (eregi($ko, $kur)) { echo "jaa"; } else { echo "nee"; } Link to comment Share on other sites More sharing options...
Venom Posted May 13, 2005 Report Share Posted May 13, 2005 nu tās vispār ir muļķības! Link to comment Share on other sites More sharing options...
Delfins Posted May 13, 2005 Report Share Posted May 13, 2005 $ko = ":02.jpg:"; $kur = ":02.jpg:05.jpg:x01.jpg:"; if (eregi($ko, $kur)) { echo "jaa"; } else { echo "nee"; } 17488[/snapback] ereg, nevis eregi kada vaina Venom !? :) Link to comment Share on other sites More sharing options...
Venom Posted May 13, 2005 Report Share Posted May 13, 2005 ar tanku pa putniem Link to comment Share on other sites More sharing options...
bubu Posted May 13, 2005 Report Share Posted May 13, 2005 (edited) ereg, nevis eregi kada vaina Venom !? :) 17490[/snapback] Tāpē, ka bremze. strpos noteikti ātrāks. Pie tam ereg vēl punktus sāks interpretēt kā patvaļīgu simbolu, un atgriezīs nekorektus rezultātus, tipa: $ko = ":0..jpg:"; $kur = ":02.jpg:05.jpg:x01.jpg:"; if (eregi($ko, $kur)) { echo "jaa"; } else { echo "nee"; } atgriezīs jā Edited May 13, 2005 by bubu Link to comment Share on other sites More sharing options...
Delfins Posted May 13, 2005 Report Share Posted May 13, 2005 ereg, nevis eregi kada vaina Venom !? :) 17490[/snapback] Tāpē, ka bremze. strpos noteikti ātrāks. Pie tam ereg vēl punktus sāks interpretēt kā patvaļīgu simbolu, un atgriezīs nekorektus rezultātus, tipa: $ko = ":0..jpg:"; $kur = ":02.jpg:05.jpg:x01.jpg:"; if (eregi($ko, $kur)) { echo "jaa"; } else { echo "nee"; } atgriezīs jā 17492[/snapback] paga paga, tā jau ir sintakse ereg-am. vajag visus specifiskos simbolus slašot Link to comment Share on other sites More sharing options...
Venom Posted May 13, 2005 Report Share Posted May 13, 2005 hā, un kas ir vienkāršāk - slašot specifiskos simbolus, jeb izmantot strpos? nebūsim bērnišķīgi, preg/eregus var izmantot, bet šeit nav tā vieta Link to comment Share on other sites More sharing options...
Recommended Posts