It was originally implemented in c ++. recently, the company needs to develop a php web site program using php + mysql + jQuery + css. Now I need to implement a function to display recommendations for articles similar to the title of this article at the end of an article, with links attached. I am wondering if it is caused by a syntax problem. please help me check it out. thank you for the following code: & quot; associate the basic php syntax of array php: php
It was originally implemented in c ++. recently, the company needs to develop a php web site program using php + mysql + jQuery + css.
Now I need to implement a function to display recommendations for articles similar to the title of this article at the end of an article, with links attached.
I am wondering if it is caused by a syntax problem. Please check it out for me. thank you.
My code is as follows:
');} // $ Demo_titile = $ row ['info _ title'];} $ resarray = getSimilars ($ demo_title, $ new_array); foreach ($ resarray as $ v) {// html output echo (''. $ v ['info _ title']. ''); echo ("
");}/** @ Param $ title the string to be compared * @ param $ arr_title the string array to be compared, which is an associated array **/function getSimilars ($ title, $ arr_title) {$ num = 0; $ ret_array = array (); foreach ($ arr_title as $ key => $ value) {// echo $ title; echo ''; echo $ key; // echo'
'; $ Percent = similar_text ($ value, $ title); // similar percentage, integer form // echo $ percent; echo ('
'); $ Temp_array [$ key] = $ percent; // Construct a new array // echo $ temp_array [$ key]; echo'
';} // Sort the $ temp_array array; arsort ($ temp_array); // echo $ temp_array [$ key]; echo'
'; // Search for and create a new array based on the $ key value of temp_array $ times = 0; foreach ($ temp_array as $ key => $ value) {// It seems that the loop has only gone through the first time, and it will not go behind? If ($ times <6) {// currently, only 6 items are recommended. // echo $ key; echo ""; echo $ value; echo'
'; $ Search = true; if ($ search = true) foreach ($ arr_title as $ tempkey => $ tempvalue) {echo $ key; echo ""; echo $ tempkey; echo'
'; If ($ key = $ arr_title) {// It seems that this if judgment does not play any role echo "find the target:"; echo $ key; echo ""; echo $ tempkey; echo'
'; // Echo $ tempkey; echo ""; echo $ tempvalue; echo'
'; $ Temp = $ tempvalue; $ ret_array [$ key] = $ temp; // Construct a new array echo "insert destination:"; echo $ ret_array [key]; echo ""; echo'
'; // Next ($ temp_array); // move the pointer down $ times ++; $ search = false ;}} reset ($ arr_title );}} foreach (Sret_array as $ key => $ value) {// echo $ key; echo ""; echo $ value; echo"
";} Return $ ret_array;} // $ title current title. $ arrayTitle is the array function getSimilar ($ title, $ arr_title) to be searched) {$ arr_len = count ($ arr_title); for ($ I = 0; $ I <= ($ arr_len-1); $ I ++) {// Obtain the number of bytes similar to two strings $ arr_similar [$ I] = similar_text ($ arr_title [$ I], $ title);} arsort ($ arr_similar ); // sort the reset ($ arr_similar) by the number of similar bytes; // move the pointer to the first unit of the array $ index = 0; foreach ($ arr_similar as $ old_index => $ similar) {$ New_title_array [$ index] = $ arr_title [$ old_index]; $ index ++;} return $ new_title_array ;}?>
In addition, I cannot debug eclipse in a single step, and I will always report the code I want to debug.
XDEBUG_SESSION_STOP_NO_EXEC = ECLIPSE_DBGP & KEY = 14229459395503
Error. Is it my configuration problem? Please help me see