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
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;

}

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.