Pentiums Posted October 15, 2009 Report Posted October 15, 2009 (edited) if($var == 'Google' || $var == 'Yahoo! Slurp' || $var == 'Rippers' || $var == 'General Crawlers') die; Kā lai to uzraksta īsāk. vai labāk. Edited October 15, 2009 by Pentiums Quote
waplet Posted October 15, 2009 Report Posted October 15, 2009 (edited) Viņam ir pietiekami īsa, ko tu tur gribi vēl saīsināt? uztaisa masīvu foreach($masivs as $ms){ for($i=0;$i<4;$i++){ if($var == $ms) die; } } ciklus maz rubīju , bet varbut iespējami šāi Edited October 15, 2009 by waplet Quote
Pentiums Posted October 15, 2009 Author Report Posted October 15, 2009 būtu labāk ievietot array'ā $var = array("Google", "bla"......); un tad ar kaadu fju parbaudit. galva nestrada vakara Quote
endrju Posted October 15, 2009 Report Posted October 15, 2009 if ( in_Array($blaah)) +1, tikai tā $blaah vietā pašu array() uzreiz nodefinē. Quote
Grey_Wolf Posted October 16, 2009 Report Posted October 16, 2009 a kaada jeega no saiisinasanas? Neparskatamaks/nesaprotamaks kods? Pat tiiri teoretiski lenaka koda izpilde? IF/ELSE operacijas izpildas krietni atrak , nekaa Meklesana masiiva , Piedevam saja gadijumaa ir 2 salidzinasanas solji meklejam Masiivaa ( saliidzinam pa baitam) un tad veleriz parbaudam uz true/false (IF/ELSES) Piedevam ietaupijums buus ljotii nieciigs, paris simboli ... P.S. jega likt masiiva buutu ja dati dinamiski mainiitos, un nebuutu iespejams ieprieks noteikt cik iisti elementi buus nepieciesmi. Bet tada gadijuma masiivs tapat jadefinee atseviskji, un ietaupijuma nav... Quote
Pentiums Posted October 16, 2009 Author Report Posted October 16, 2009 (edited) Vēlviens jautājums, kā no šiem: 1] http://www.google.lv/search?hl=lv&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=QHK&q=fraaze+ko+meklee&btnG=Mekl%C4%93t 2] http://www.google.lv/url?q=vansa+tilta+web+kamera dabūt ārā šos: 1] fraaze+ko+meklee 2] vansa+tilta+web+kamera nemāku uzrakstīt pareizu izteiksmi iekš preg_match :( Edited October 16, 2009 by Pentiums Quote
Maris-S Posted October 16, 2009 Report Posted October 16, 2009 Stipri neiedziļinājos, bet papēti funkcijas parse_url un parse_str. Quote
xPtv45z Posted October 16, 2009 Report Posted October 16, 2009 if($var == 'Google' || $var == 'Yahoo! Slurp' || $var == 'Rippers' || $var == 'General Crawlers') die; var arī tā if($var == ('Google' || 'Yahoo! Slurp' || 'Rippers' || 'General Crawlers')) die; Quote
bubu Posted October 16, 2009 Report Posted October 16, 2009 xPtv45z: tā gan nevar. Tavas uzrakstītās abas rindiņas dara pilnīgi atšķirīgas lietas. Quote
briedis Posted October 16, 2009 Report Posted October 16, 2009 (edited) if($var == 'Google' || $var == 'Yahoo! Slurp' || $var == 'Rippers' || $var == 'General Crawlers') die; var arī tā if($var == ('Google' || 'Yahoo! Slurp' || 'Rippers' || 'General Crawlers')) die; Pārfrāzējot sanāk tā if($var == (true || true || true || true)) die; saīsinot if($var == true) die; Es visdrīzāk uztaisītu switch... Edited October 16, 2009 by briedis Quote
xPtv45z Posted October 16, 2009 Report Posted October 16, 2009 Jā taisnība, nepārbaudīju kārtīgāk. Quote
marcis Posted October 18, 2009 Report Posted October 18, 2009 lol, kāds te vēl switch? Vai arī es kaut ko palaidu garām? if(in_array($var, array('Google', 'Yahoo! Slurp', 'Rippers', 'General Crawlers'))) die(); Quote
FiXeD Posted November 4, 2009 Report Posted November 4, 2009 tur kur tev vajag dabut ārā no linka tos vārdus vnk ar explode pamēģini! vnk $somevar = "http://www.google.lv/search?hl=lv&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=QHK&q=fraaze+ko+meklee&btnG=Mekl%C4%93t"; $piishi = explode("&q=", $somevar); echo $piishi[0]; // izvadiis tev to, kas ir liidz &q= echo $piishi[1]; // uzvadiis tev to, kas bija aiz &q= //daram to velreiz tik vairs izmantojot 2 dalju no ta garaa pentera $whatever = explode("&btn", $piishi[1]) // spridzinam liidz ar &btn uz puseem ... varetu jau tikkai & bet ja mekletaja teksta bus tad nebus tas ko vajag echo $whatever[0]; // izvadis tev fraaze+ko+meklee echo $whatever[1]; // izvadis G=Mekl%C4%93t es sava laikā šādi spridzināju youtube video linkus, lai uz thumbnail bilžu linkiem dabūtu video id no db Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.