m0zus Posted February 14, 2007 Report Share Posted February 14, 2007 $a="abcdefg"; if ($a=="c") {echo "tralala..";} Kas jādara lai nevis pielīdzinātu visam "abcdefg" bet pārbaudītu tikai vai $a satur burtu c ? Link to comment Share on other sites More sharing options...
v3rb0 Posted February 14, 2007 Report Share Posted February 14, 2007 http://php.net/strpos Link to comment Share on other sites More sharing options...
m0zus Posted February 14, 2007 Author Report Share Posted February 14, 2007 if (strpos($row[acc],'a') == true){ echo "<strong><div style='color:#ff0000;'>". $row[vaards] . "</div></strong>";} elseif (strpos($row[acc],'m') == true){ echo "<div style='color:#ff0000;'>". $row[vaards] . "</div>";} elseif (strpos($row[acc],'b') == true){ echo "<div style='color:#0066FF;'>". $row[vaards] . "</div>";} izmet tikai vienu vārdu un ar krāsu kādam jābūt m acc, kautkan acc ir abcdmr Link to comment Share on other sites More sharing options...
v3rb0 Posted February 14, 2007 Report Share Posted February 14, 2007 a izlasīji kas tur rakstīs? 1. strpos atriegž pozīciju, burts 'a' ir kādā pozīcijā? pareizi 0, vai 0 == true?? 2. izlasi ko dara elseif. Link to comment Share on other sites More sharing options...
Stopp Posted February 14, 2007 Report Share Posted February 14, 2007 http://php.lv/f/index.php?showtopic=6277 if (strpos($a, "a")!==false) { echo "jejj, mums ir sakritība!"; } Link to comment Share on other sites More sharing options...
Recommended Posts