Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:18:10+00:00 2026-06-15T20:18:10+00:00

I keep getting the following error and I was wondering on how to fix?

  • 0

I keep getting the following error and I was wondering on how to fix?

This is the second time I got this error I fixed it the first time but for some reason I cant fix it the second time.

Fatal error: Unsupported operand types on line 14

Here is line 14

$sub=$a-$b;

Here is the full code below.

<?php



$x=array(2,10);
$y=array(3,5);
$z=D($x,$y);

echo ('sum is :'.$z);

/** compute Euclidean distance http://en.wikipedia.org/wiki/Euclidean_distance */
 function D ($a,  $b)
{
    $sub=$a-$b;
    return pow($sub,2);
}
function distance_betwen($p,$q)
{
    $nu_argu=func_num_args();
    if( $nu_argu!=2)
    {
        echo 'please enter a valid 2 coordinates like this (1,2)';
    }
    else if (sizeof($p)!=sizeof($q))
    {
        echo 'values of each pair must have the same dimention';
    }
    else
    {
        $c=array_map("D",$p,$q);
        return pow(array_sum($c),0.5);
    }
}

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:18:12+00:00Added an answer on June 15, 2026 at 8:18 pm

    Your $z=D($x,$y); $x and $y is array

    You can’t do substraction with two array $sub=$a-$b;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason i keep getting the following error when i try to set
I've tried many configurations, but I keep getting the following error upon opening eclipse:
Not sure what is wrong with this code. I keep getting the following error:
I am trying to set SignalR up, but I keep getting the following error
I keep getting the following error when trying to parse some html using BeautifulSoup:
I keep getting the following error: could not locate named parameter [articleCommentId] but it
I'm following some tutorials on mysql function creation but I keep getting the following
I keep getting following error on this code: #Setup default variables $webUrl = Get-SPWeb
I keep getting the following error message at compile time: The name 'Message' does
I keep getting the following error: Method not found: 'Void Castle.MicroKernel.ComponentActivator.ComponentActivatorException..ctor this is from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.