PHP - [php] Random Word From Array
Hey guys does anyone know how i would go about generating a random word from an array?
For example: $words = array("[apple]","[banana]","[kiwi]"); how would i have php choose one of these words and then spit it out? Thanks!!! Similar TutorialsHi, Does anyone know how to create a php file which will ask the user to enter three random characters from their pre-selected word. It would be like with online banking where you have to enter for example letters 2, 4 and 5 from your memorable data. Any help would be greatley appreciated. Thanks Hey i hope the title explains it enough. I'm just trying to get into classes. I am making a function to make making mysql querys easier. I pass the class the first string $db->inputstring("INSERT INTO ? (?,?) VALUES ('?','?')"); $db->format('mytable','id','name','1','ben'); Can someone tell me how the format fuction would look? Im not sure how to swap arrays. hello. im trying to get some results from a db and all i keep getting is the word ARRAY ?? I want to get all the placeholders that relate to a page. so if pageID=1 has place holder 1, place holder 2 and place holder 3 it will return 1, 2, 3 etc... in the db i have id pageID phNumber 1 1 1 2 1 2 3 1 3 etc.. this is the code i have Code: [Select] public function find_placeholders($pageID=0){ $sql = "SELECT phNumber FROM ".self::$table_name." WHERE pages_id=".$pageID.""; $result_array = self::find_by_sql($sql); return $result_array; } and on the page i have.. Code: [Select] <?php echo Placeholders::find_placeholders($pageID); ?> all i get is Quote Array once i solve this problem i will want to use each number in the array to find the content for each. so if i get 1,2,3 i will try and do some thing like. foreach placeholder number echo elements but 1 step at a time thanks for any help rick Hi guys, I have a simple query he $sql="SELECT user_id FROM $tbl_name WHERE email='$loginuseremail' AND password='$loginpassword'"; $result=mysql_query($sql); $row = mysql_fetch_assoc($result); //START SESSION session_start(); $_SESSION['username']=$loginuseremail; $_SESSION['user_id']=$row; echo $_SESSION['user_id']; It should obviously output an ID number but instead I just get the word 'Array'. If I remove the mysql_fetch_assoc() I just get 'Resource ID #4'. Can anyone point me in the right direction? Thanks! Hello phpfreaks I'm a bit new to PHP, as well as this forum. I'm learning in a fast way, but there's something I can't seem to figure out, nor find it on google. I'm sure it's a simple and basic trick, but like I said, I'm just a beginner So the question is: How can I store multiple words to an array, using only 1 input form field? I guess it's with a for-loop..? So everytime you hit the 'submit' button, a new word should be added to the array. My problem is that I'm always overwriting ONE word.. This is what I've got so far.. : Code: [Select] <?php if (isset($_POST['word'])){ $word = $_POST['word']; $word = strip_tags($word); $word = trim($word); $word = htmlentities($word); } else { $word = ""; } ?> <div id="arrays"> <p>Add a word to the array below:<br /><br /></p> <form action="index.php" method="post"> <input id="word" name="word" type="text" value="<?php echo $word; ?>" /> <br /><input class="btn" type="submit" value="Submit" /> </form> <br /> <p> <?php $array = array("apple", "banana", "lemon", $word); for ($i = 0; $i < count($array); $i++){ echo $array[$i] . " "; } ?> </p> </div> Also: I'm using PHP 5, in combination with xHTML strict 1.0. I'm using the code below to on echo certain words based on their index/key value, this works fine however, im trying to only do this in exploded quotes... the problem is, exploding quotes turns the portion into an array which cant be passed to str_word_count... how can i do the same thing only inside quotes. So that hello world "this is a test" would become: Code: [Select] Hello World This [0] => Is [1] => a [2] => Test [3] Im trying to always remove say the 4th word in quotations, or maybe the 3rd and 4th, whatever i want to omit i leave out from the echo, so echo $data[0].' '.$data[3].'; would output "This Test" omitting "Is A" Code: [Select] $data = 'hello world "this is a test"'; $data = str_word_count($data, 1); echo $data[1].' '.$data[2].' '.$data[0]; I dont know how to word this really. what I want to do is Code: [Select] $Var[] = 3; $Var[] = 6; $Var[] = 2; $Var[] = 17; for($i=0; $i!=count($Var); $i++) { echo "#$i: ".$Var[$i]."\n"; } I know I might be able to use rand() but I need it to echo ALL of the variables in the array in a random order, I know if I use count to find out how many variables there are that it would echo them 4 times randomly but might echo the same variable 2 times making it to where it only echos 3 different varables, if I am being confusing please let me know, I just want to get this resolved, thanks! Hello all, I am newbie to php programming, any suggestions or advance greatly appreciated. I can't figure out how to output two array random numbers in ascending order. <?php $l_numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47); $mega = range(1, 27); for($i = 0; $i <= 4; $i++) { $random1 = array_rand($l_numbers); echo "$random1 \n" ; } for($e = 1; $e <= 1; $e++) { $random2 = array_rand($mega); echo "<p> Mega number is $random2 </p>"; } echo "Winning numbers are $random1 and mega $random2"; ?> example: Winning numbers are 3,5,10,17,39 and mega 5. Code: [Select] require('../conn/db_connection.php'); //seleksi restoran $pilih_resto="select * from restoran"; $query_pilih_resto=mysql_query($pilih_resto); echo "<h3>Truly Data : </h3>"; while($resto=mysql_fetch_array($query_pilih_resto)){ echo"<font color='red'>".$resto["id_restoran"].".". $resto["nama_restoran"]."</font><br>"; $seleksi_menu_1="select * from jenis_menu"; $query_menu_1=mysql_query($seleksi_menu_1); while($menu_1=mysql_fetch_array($query_menu_1)){ echo "<font color='green'>".$menu_1["id_jenis_menu"]."</font><br>"; $seleksi_data_eat="select * from eat where id_restoran like '".$resto["id_restoran"]."' and id_jenis_menu like '".$menu_1["id_jenis_menu"]."'"; $query_eat=mysql_query($seleksi_data_eat); while($eat=mysql_fetch_array($query_eat)){ echo $eat["nama_eat"]."<br>"; } } echo"<br>"; } echo "------------------------------<br>"; echo "<h3>Random Data : </h3>"; $pilih_resto_2="select * from restoran"; $query_pilih_resto_2=mysql_query($pilih_resto_2); $menu_PNP="PNP"; $menu_PBK="PBK"; $menu_UTM_1="UTM"; while($data_resto=mysql_fetch_array($query_pilih_resto_2)){ echo "<b>".$data_resto["id_restoran"]."-".$data_resto["nama_restoran"]."</b><br>"; $seleksi_data_eat_PNP="select * from eat where id_restoran like '".$data_resto["id_restoran"]."' and id_jenis_menu like '".$menu_PNP."'"; $seleksi_data_eat_PBK="select * from eat where id_restoran like '".$data_resto["id_restoran"]."' and id_jenis_menu like '".$menu_PBK."'"; $seleksi_data_eat_UTM="select * from eat where id_restoran like '".$data_resto["id_restoran"]."' and id_jenis_menu like '".$menu_UTM_1."'"; $query_eat_UTM=mysql_query($seleksi_data_eat_UTM); $jml_data_UTM=mysql_num_rows($query_eat_UTM); echo "Summary of main Menu : $jml_data_UTM<br>"; $query_eat_PNP=mysql_query($seleksi_data_eat_PNP); $query_eat_PBK=mysql_query($seleksi_data_eat_PBK); while($eat_PNP=mysql_fetch_array($query_eat_PNP)){ $data_eat_PNP[]=$eat_PNP["nama_eat"]; } while(list($index_PNP,$data_PNP)=each($data_eat_PNP)){ $data_eat_PNP_list[$index_PNP]=$data_PNP; } while($eat_PBK=mysql_fetch_array($query_eat_PBK)){ $data_eat_PBK[]=$eat_PBK["nama_eat"]; } while(list($index_PBK,$data_PBK)=each($data_eat_PBK)){ $data_eat_PBK_list[$index_PBK]=$data_PBK; } while($eat_UTM=mysql_fetch_array($query_eat_UTM)){ $eat_UTMx[]=$eat_UTM["nama_eat"]; } for($i=0;$i<$jml_data_UTM;$i++){ $random_data_PNP[$i]=array_rand($data_eat_PNP_list,1); $random_data_PBK[$i]=array_rand($data_eat_PBK_list,1); echo "<font color='red'>".$data_eat_PNP_list[$random_data_PNP[$i]]."</font>---<font color='green'>". $eat_UTMx[$i]."</font>---<font color='blue'>".$data_eat_PBK_list[$random_data_PBK[$i]]."</font><br>"; } } Please Help, There is a random error data how to create random data like this? Data => Restoran A: Menu appetizers : - Sup - Sate Usus - Trancam Main Menu - Nasi Goreng - Nasi Goreng Putih - Nasi + Ayam Penyet - Nasi + Bebek Panggang - Ikan Gurame Asam + Nasi - Nasi Soto Menu Dessert - Pudding - Buah Segar - Juice Aplukat Restoran B : Menu appetizers -Sup Ikan Paprika -Sup Jamur Spesial -Sup Urat Sapi Saus Tiram -Sup May Jala - Jala Main Menu - Bubur Ayam Kombinasi - Bubur Ayam/Sapi Clay Pot - Bubur Telor Pitan Clay Pot - Gurame Panggang - Pangsit Udang - Cumi-cumi Goreng Special - Kepiting Lembek Mentega - Sayap Ayam Panggang Dessert -Juice Alpukat -Mix Juice -Sui Kiau Goreng Salad -Ha Kaou Sayuran Out Put : Restoran A : Menu e ---+--- Main Menu --+---- Dessert ---------------------------------------------------- Sup ------- Nasi Goreng ------- Pudding Sup ------- Nasi Goreng Putih ------- Juice Aplukat Sate Usus ------- Nasi + Ayam Penyet ------- Pudding Sup ------- Nasi + Bebek Panggang ------- Buah Segar Trancam ------- Ikan Gurame Asam + Nasi ------- Buah Segar Sate Usus ------- Nasi Soto ------- Pudding Restoran B : Menu Pembuka ---+-- Menu Utama --+--- Menu Penutup ----------------------------------------------------------------------- Sup Ikan Paprika ------- Bubur Ayam Kombinasi ------- Juice Alpukat Sup Urat Sapi Saus Tiram ------- Bubur Ayam/Sapi Clay Pot ------- Sui Kiau Goreng Salad Sup May Jala-Jala ------- Bubur Telor Pitan Clay Pot ------- Juice Alpukat Kepiting Lembek Mentega ------- Gurame Panggang ------- Juice Alpukat Sup Urat Sapi Saus Tiram ------- Pangsit Udang ------- Mix Juice Sup May Jala-Jala ------- Cumi-cumi Goreng Special ------- Ha Kaou Sayuran Sup Jamur Spesial ------- Kepiting Lembek Mentega ------- Sui Kiau Goreng Salad Sup May Jala-Jala ------- Sayap Ayam Panggang ------- Ha Kaou Sayuran Note : appetizers and desserts at random based on count of data main menu Hi guys! i got this code: Code: [Select] <? $x = "abcde"; str_split($x); for ($k=0; $k<=119; $k++){ $ax = array($x[0],$x[1],$x[2],$x[3],$x[4]); shuffle($ax); $text = implode("", $ax) . ""; echo $text; echo "<br />"; } ?> if you test it you see that it is working but giving me allot of duplicates results! there is a way to ignore duplicaes while it is runing? thanx. I have it to where it groups two parts of the Array randomly but I need to make it where it won't pair the same together, or if it has already been paired with a team then use another team. Each value of the array can only be used once. Here is my code shuffle($teamname); $loopCount = $games; for ($i = 0; $i < $loopCount; $i++) { $player1 = array_pop($teamname); $player2 = array_pop($teamname); if(is_null($player1)) { echo 'Not enough different teams to create '.$games.' games'; break; } // output to screen echo "Team: " . $player1 . " Vs Team: " . $player2 . "<br />"; } } I have a user table that holds email addresses and for testing purposes I am trying to replace every email address with an email address defined in an array. I would like to randomly choose an email address from the array and update the table with this address. When I run the following code it randomly chooses a email address from the array but then updates every row with this one email address. Can you someone please let me know what I am doing wrong. Thanks in advance. Code: [Select] $query = "SELECT * FROM user '"; $result = mysql_query($query); $input = array('email1', 'email2', 'email3', 'email4', 'email5', 'email6', 'email7'); $rand_keys = array_rand($input, 2); $replaceStr = $input[$rand_keys[0]]; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $rand_keys = ""; $rand_keys = array_rand($input, 2); $replaceStr = $input[$rand_keys[0]]; mysql_query("UPDATE user SET email = '$replaceStr'"); } As above, I have a lottery style site that picks a random number between 1-8 but my users complain for some reason that this is not enough. So i was told to look into using fopen and random.org to generate a random number. Anyone have experience of this and perhaps a code snippet for me to look at and possibly use? help will be appreciated. Hi guys I'm struggling a bit, I need to replace a word that occurs multiple times in text with an array("up","down","forward","backwards") of words. $find = "left"; $replace = array("up","down","forward","backwards"); $text = "left left left left"; echo str_replace($find,$replace,$text); The Output is: array array array array Did try this with a foreach statement as well, but no luck. Is there a better way of doing this? Thanks I have this code below the browser shows correct data but when i export to word I see $proc output not the switch data like on the the browser page
How should code be written to show the same on word doc .
I'm new to this learning by trial and error Please go easy on me .
Thanks
<td> <? Hey guys i found this script that works great for what i need .. se i have this script that i did for my body (loan application) now i would like to export the info in a word doc <?php $ExcelFileName="test.doc"; header("Content-type: application/x-ms-download"); header("Content-Disposition: attachment; filename=$ExcelFileName"); header('Cache-Control: public'); $content=<<<EOD echo 'php'; whatever you want to write here including a php script it will be included in a string and then go in the output for a doc file EOD; echo $content; ?> so im trying to eco all the content in the database.. i tryed all the DB connection is there.. ao i place this after the (echo 'php' while($info = mysql_fetch_array($fileLIST)){; echo $info['PERS_F_NAME']; }; i get this? Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/autosspe/public_html/admin/loan/word.php on line 21 I'm going to post the code that I am currently using and then explain what I'm trying to do. I hope I can explain it well enough. <?php if (!isset($_POST['submit'])) { echo'<leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0"> <center><form name="fairlistlist" method="POST" action="'.$_SERVER['PHP_SELF'].'"> <TABLE width="450" height="119" border=0 cellPadding=3 cellSpacing=2 bgcolor="#fff568"> <TBODY> <TR> <TD class=mainText width="100"><b>Event Name</b></TD> <TD width="305" class=frmInput> <INPUT class=mainFormBox style="WIDTH: 320px" type="text" name=" fairname"></TD> </TR> <TR> <TD class=mainText width="100"><B>Event Address</B></TD> <TD class=frmInput> <INPUT name="fairadd" type="text" class=mainFormBox id="fairadd" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event City</b></TD> <TD class=frmInput> <INPUT name="faircity" type="text" class=mainFormBox id="faircity" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event County</b></TD> <TD class=frmInput> <INPUT name="faircty" type="text" class=mainFormBox id="faircty" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event State</b></TD> <TD class=frmInput> <INPUT name="fairstate" type="text" class=mainFormBox id="fairstate" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event Country</b></TD> <TD class=frmInput> <INPUT name="fairctry" type="text" class=mainFormBox id="fairctry" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event Opening Date</b></TD> <TD class=frmInput> <INPUT name="fairopen" type="text" class=mainFormBox id="fairopen" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event Closing Date</b></TD> <TD class=frmInput> <INPUT name="fairclose" type="text" class=mainFormBox id="fairlose" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event Contact Email</b></TD> <TD class=frmInput> <INPUT name="fairmail" type="text" class=mainFormBox id="fairmail" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=mainText width="100"><b>Event Website</b></TD> <TD class=frmInput> <INPUT name="fairweb" type="text" class=mainFormBox id="fairweb" style="WIDTH: 320px"></TD> </TR> <TR> <TD class=frmDescription width="56"> </TD> <TD class=frmInput> <div align="right"> <input type="submit" name="submit" value="Add my Event" /> </div></TD> </TR> </TBODY> </TABLE> </form></center> </body>'; //note that I added a new field called submit and it's hidden .. } else { /*I added addslashes() so it escape any special char in the form .. if you want to show your inserted record , you need to use stripslashes() to remove any slashes from the record .. this is only to avoid some security problems in the query ..*/ $fairname=trim(addslashes($_POST['fairname'])); $fairadd=trim(addslashes($_POST['fairadd'])); $faircity=trim(addslashes($_POST['faircity'])); $faircty=trim(addslashes($_POST['faircty'])); $fairstate=trim(addslashes($_POST['fairstate'])); $fairctry=trim(addslashes($_POST['fairctry'])); $fairopen=trim(addslashes($_POST['fairopen'])); $fairclose=trim(addslashes($_POST['fairclose'])); $fairmail=trim(addslashes($_POST['fairmail'])); $fairweb=trim(addslashes($_POST['fairweb'])); include("Connections/local.php"); $link = mysql_connect($hostname_local,$username_local, $password_local) or die("Could not connect"); mysql_select_db('fair123') or die("Could not select database"); $insert=mysql_query("INSERT INTO events (fairidnum, fairname, fairadd, faircity, faircty, fairstate, fairctry, fairopen, fairclose, fairmail, fairweb) VALUES('NULL', '$fairname', '$fairadd', '$faircity', '$faircty','$fairstate', '$fairctry','$fairopen', '$fairclose', '$fairmail', '$fairweb')")or die('couldn\'t Insert record into database :'.mysql_error()); header( 'Location: event_added.php' ) ; } ?> Especially look at the code part here $insert=mysql_query("INSERT INTO events (fairidnum, fairname, fairadd, faircity, faircty, fairstate, fairctry, fairopen, fairclose, fairmail, fairweb) VALUES('NULL', '$fairname', '$fairadd', '$faircity', '$faircty','$fairstate', '$fairctry','$fairopen', '$fairclose', '$fairmail', '$fairweb')")or die('couldn\'t Insert record into database :'.mysql_error()); header( 'Location: event_added.php' ) ; } ?> this is where I am having problems it was reading echo your record has been successfully added to the database What I want is for it to open up a new page with my menu and my css and all that good crap to a page where it will read the following Your information has been added to our database We have added Event name = "whatever the event's name was" Event address = "address:" so on and so on for all the fields in my form that was submitted to the database. with just using the echo command it always opened to just a blank page no formatting and no css as well as no all important links Can you please tell me what I'm doing wrong or where I can find a good guideline that Is easy to understand on how to do this? Thanks in advance Oh also I don't care if that page get's indexed by google or yahoo or not actually prefer it don't get indexed to be honest Hi guys, I'm trying to export records from php to ms word which appends text + image. i have got this code from http://www.thaicreate.com/php/php-word.application-addpicture.html Code: [Select] <html> <head> <title>ThaiCreate.Com PHP Word.Application Tutorial</title> </head> <body> <? $wdColorDarkRed = "&H80"; $wdAlignParagraphCenter = "1"; $wdAlignParagraphLeft = "0"; $wdParagraph = "4"; $wdHorizontalPositionMargin = "0"; $wdTableLeft = "-999998"; $wdCollapseEnd = "0"; $Wrd = new COM("Word.Application"); $DocName = "MyDoc/MyWord.doc"; //$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp $Wrd->Application->Visible = False; $WrdDoc = $Wrd->Documents->Add(); $MyRange1 = $WrdDoc->Paragraphs->Add->Range; $MyRange1->ParagraphFormat->Alignment = $wdAlignParagraphCenter; $MyRange1->Font->Name = "Verdana"; $MyRange1->Font->Size = "30"; $MyRange1->Font->Bold = True; $MyRange1->InsertBefore(chr(13).chr(13)."www.ThaiCreate.Com".chr(13)."Version 2009"); $MyRange1->InlineShapes->AddPicture(realpath("thaicreate-2009.gif")); //$WrdDoc->InlineShapes->AddPicture(realpath("thaicreate-2009.gif")); //$WrdDoc->Shapes->AddPicture(realpath("thaicreate-2009.gif"),0,0,MyRange1); //$WrdDoc->Shapes->AddPicture(realpath("thaicreate-2009.gif"),0,0,Wrd->Selection->Range); $MyRange2 = $WrdDoc->Paragraphs->Add->Range; $MyRange2->ParagraphFormat->Alignment = $wdAlignParagraphCenter; $MyRange2->Font->Name = "Verdana"; $MyRange2->Font->Size = "15"; $MyRange2->Font->Bold = True; $MyRange2->InsertBefore(chr(13).chr(13)."PHP,ASP and ASP.NET Tutorial"); $MyRange2->InlineShapes->AddPicture(realpath("doc.gif")); $MyRange3 = $WrdDoc->Paragraphs->Add->Range; $MyRange3->ParagraphFormat->Alignment = $wdAlignParagraphCenter; $MyRange3->Font->Name = "Verdana"; $MyRange3->Font->Size = "10"; $MyRange3->Font->Bold = True; $MyRange3->Font->Color = $wdColorDarkRed; $MyRange3->Underline = True; $MyRange3->InsertBefore(chr(13).chr(13).chr(13).chr(13)."All Rights Reserved"); //$WrdDoc->SaveAs($strPath."/".$DocName); $WrdDoc->SaveAs(realpath($DocName)); $Wrd->Application->Quit; $Wrd = null; ?> Word Created <a href="<?=$DocName?>">Click here</a> to Download. </body> </html> This is the best code i've found so far that guides on how to format the text in ms word via PHP. All set to go but one thing that I am trying to accomplish : to have a clickable email address (hyperlink) in the same ms word file. i have got this code somewhere from the net: Code: [Select] $MyRange3->Hyperlinks->Add({range}, 'http://www.google.com', '','',' hyperlink text to display'); // where {range} refers to as anchor according to that website this methods could be found in ms word visual basic editor (Alt+F11) then object browser (F2) when i replace the {range} above with let say variable $MyRange3. Code: [Select] $MyRange3->Hyperlinks->Add($MyRange3, 'http://www.google.com', '','',' hyperlink text to display'); The output will be produced but overwriting everything in $MyRange3 and displays only the hyperlink. I would like the email address (hyperlink) to appear at the end of $MyRange3 text. example output Code: [Select] All right reserved [u]hyperlink text to display[/u] anyone can shed some light on this. Hello Guys, I need some help here.. I want to implement a Bad word filter and not quite sure how to do it.. I am grabbing the following vars from the text fields $ad_title = filter_var($_POST['ad_title'], FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES); $ad_body = filter_var($_POST['description'], FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES); Then its inserted into the db. I would like to run it through this function first.. Code: [Select] FUNCTION BadWordFilter(&$text, $replace){ // fill this array with the bad words you want to filter and their replacements $bads = ARRAY ( ARRAY("butt","b***"), ARRAY("poop","p***"), ARRAY("crap","c***") ); IF($replace==1) { //we are replacing $remember = $text; FOR($i=0;$i<sizeof($bads);$i++) { //go through each bad word $text = EREGI_REPLACE($bads[$i][0],$bads[$i][1],$text); //replace it } IF($remember!=$text) RETURN 1; //if there are any changes, return 1 } ELSE { //we are just checking FOR($i=0;$i<sizeof($bads);$i++) { //go through each bad word IF(EREGI($bads[$i][0],$text)) RETURN 1; //if we find any, return 1 } } } // this will replace all bad words with their replacements. $any is 1 if it found any $any = BadWordFilter($wordsToFilter,1); I really would also like to query a table for any words that match and then use a replacement like [censored] Any help would be greatly appreciated! I have a table in my php Mysql which contains some values.. Is it possible to get those values then export them to MS word with formatting? and make it like a table? Help pls. |