Jump to content

need help asap...project due tomorrow :(


riceje7

Recommended Posts

so i have this project due tomorrow and i can't seem to get my code to work, i'm trying to check the values of user input to a list of stop words for a tag cloud, however it doesn't seem to work at all. i've trie unset(), array_splice(), and tried just creating a new array. any help at all would be incredible. attached is my code, the code that is supposed to remove the stop words from the array is called removeswords.php. thanks a bunch

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/182670-need-help-asapproject-due-tomorrow/
Share on other sites

<?php

 

function removeswords(&$arraytotrunc){

$tempfilename = "stopwords.txt";

$fp = fopen($tempfilename, "r");

$tempdata = fread($fp, filesize($tempfilename));

fclose($fp);

$swords = array();

$swords = parsetext($tempdata);

foreach($swords as $key => $value){

//echo($key."=>".$value."<br/>");

}

 

$newarray = array();

 

foreach($arraytotrunc as $key => $value){

//echo($key."<br/>");

for($i = 0; $i < sizeof($arraytotrunc); $i++){

for($x=0;$x < sizeof($swords); $x++){

if($key != $swords[$x]){

$newarray[$i] = $key;

//removeswords($arraytotrunc);

}

}

}

}

//$truncarray = array_values($arraytotrunc);

$temparray = array_values($newarray);

//var_dump($temparray);

return $newarray;

}

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.