Click here to Skip to main content
15,880,469 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Search engines Pin
Calin Negru8-Mar-22 19:52
Calin Negru8-Mar-22 19:52 
AnswerRe: Search engines Pin
Member 150787164-Jul-22 16:32
Member 150787164-Jul-22 16:32 
QuestionAre lightweight CMS still around? Pin
RobertSF25-Feb-22 13:10
professionalRobertSF25-Feb-22 13:10 
AnswerRe: Are lightweight CMS still around? Pin
RobertSF14-Mar-22 8:53
professionalRobertSF14-Mar-22 8:53 
GeneralRe: Are lightweight CMS still around? Pin
deepok130-Mar-22 23:53
deepok130-Mar-22 23:53 
GeneralRe: Are lightweight CMS still around? Pin
RobertSF2-Apr-22 5:14
professionalRobertSF2-Apr-22 5:14 
QuestionProperly setting up Apache2 to avoid upload timeouts with Microsoft OneDrive Pin
SergioQ22-Feb-22 7:38
SergioQ22-Feb-22 7:38 
AnswerRe: Properly setting up Apache2 to avoid upload timeouts with Microsoft OneDrive Pin
Richard MacCutchan22-Feb-22 8:04
mveRichard MacCutchan22-Feb-22 8:04 
GeneralRe: Properly setting up Apache2 to avoid upload timeouts with Microsoft OneDrive Pin
SergioQ22-Feb-22 9:24
SergioQ22-Feb-22 9:24 
GeneralRe: Properly setting up Apache2 to avoid upload timeouts with Microsoft OneDrive Pin
Richard MacCutchan22-Feb-22 9:36
mveRichard MacCutchan22-Feb-22 9:36 
GeneralRe: Properly setting up Apache2 to avoid upload timeouts with Microsoft OneDrive Pin
SergioQ22-Feb-22 9:40
SergioQ22-Feb-22 9:40 
AnswerRe: Properly setting up Apache2 to avoid upload timeouts with Microsoft OneDrive Pin
Peter_in_278023-Feb-22 17:33
professionalPeter_in_278023-Feb-22 17:33 
QuestionUpload problems from my web form, only when file is located on a cloud drive, i.e. MS' OneDrive Pin
SergioQ19-Feb-22 9:19
SergioQ19-Feb-22 9:19 
QuestionWhere do people go to discuss PWA development? Pin
bjoernen19-Feb-22 1:26
bjoernen19-Feb-22 1:26 
AnswerRe: Where do people go to discuss PWA development? Pin
RedDk19-Feb-22 9:05
RedDk19-Feb-22 9:05 
AnswerRe: Where do people go to discuss PWA development? Pin
jhonaa27-Mar-22 23:52
jhonaa27-Mar-22 23:52 
QuestionWhat are the usage of the req.route() in express ? Pin
Member 1447916115-Feb-22 10:43
Member 1447916115-Feb-22 10:43 
AnswerRe: What are the usage of the req.route() in express ? Pin
jhonaa7-Mar-22 23:15
jhonaa7-Mar-22 23:15 
AnswerRe: What are the usage of the req.route() in express ? Pin
deepok130-Mar-22 21:56
deepok130-Mar-22 21:56 
QuestionWhy is my last input box not centering (class: powerwall-battery-input)? Pin
WannaBeAWebDev11-Feb-22 14:22
WannaBeAWebDev11-Feb-22 14:22 
AnswerRe: Why is my last input box not centering (class: powerwall-battery-input)? Pin
Richard MacCutchan11-Feb-22 22:34
mveRichard MacCutchan11-Feb-22 22:34 
QuestionWeird HTTP Status code 302 "Moved Temporarily" Pin
#realJSOP3-Feb-22 0:17
mve#realJSOP3-Feb-22 0:17 
AnswerMessage Closed Pin
4-Jul-22 16:45
Member 150787164-Jul-22 16:45 
GeneralRe: Weird HTTP Status code 302 "Moved Temporarily" Pin
#realJSOP4-Jul-22 23:41
mve#realJSOP4-Jul-22 23:41 
QuestionPHP7, build an array and select one array record based on value Pin
jkirkerx24-Jan-22 11:19
professionaljkirkerx24-Jan-22 11:19 
I can't figure this out.

I have an array ...
And I want the array record with the minimum distance of 6, in which I calculated already. I figured PHP7 had a function to just select a record in an array, but I can't find it, or it's done some other way that I'm not familiar with.
Input word: mini-stonescape group iii - Lev Distance: 6 - Shortest: 6
Did you mean: stonescapes group iii

Smallest Distance: 6
array(16) {
  [0]=>
  array(3) {
    ["key"]=> string(10) "REF_PA_365"
    ["value"]=> string(21) "stonescapes group iii"
    ["distance"]=> int(6)
  }
  [1]=>
  array(3) {
    ["key"]=> string(10) "REF_PA_364"
    ["value"]=> string(20) "stonescapes group ii"
    ["distance"]=> int(7)
  }
  [2]=>
  array(3) {
    ["key"]=> string(10) "REF_PA_081"
    ["value"]=> string(19) "stonescapes group i"
    ["distance"]=> int(8)
  }

As far as code goes, well I tried about 10 things with failure. So I deleted all my tries. I have nothing but an array. I just need a nudge, a keyword or something.
// if this distance is less than the next found shortest word
// distance, OR if a next shortest word has not yet been found
if ($distance <= $shortest || $shortest < 0) {
    // set the closest match, and shortest distance
    $closest  = $value;
    $shortest = $distance;
}

echo "Input word: $partDescription - Lev Distance: $distance - Shortest: $shortest\n";
if ($shortest == 0) {

    echo "Exact match found: $closest\n\n";
    $pValue = $closest;

} else {

    echo "Did you mean: $closest\n\n";

    // Analyse the word more in detail
    $distances = array_column($comparisons, 'distance');
    $smallestDistance = min($distances);
    echo "Smallest Distance: $smallestDistance\n";
    var_dump($comparisons);

    // $pValue = $answer['key'];
    // $closest = $answer['value'];
    echo "Best choice: $closest\n\n";
    var_dump($pValue);

}
If it ain't broke don't fix it
Discover my world at jkirkerx.com

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.