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 6474597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:36:21+00:00 2026-05-25T06:36:21+00:00

I was trying to access GCD from inside Algorithm but it’s not letting me

  • 0

I was trying to access GCD from inside Algorithm but it’s not letting me and I’m not sure why. What am I doing wrong here?

    public function gcd($x,$y) 
    {
        do {
            $rest=$x%$y;
        $x=$y;
        $y=$rest;
        } while($rest!==0);
        return $x;
    }

    public function algorithm()
    {
        $alpha = array(
            'c' => str_split('bcdfghjklmnpqrstvwxz'),
            'v' => str_split('aeiouy')
        );
        $i=$k=0;
        foreach ($this->output as $item) {
            $cnt = 0;
            $this->digits[$i] = array();
            foreach ($item as $part) {
                $this->digits[$i][$cnt] = array();
                $new = array();
                foreach ($part as $str) { 
                    $v = count(array_intersect(str_split($str), $alpha['v']));
                    $c = count(array_intersect(str_split($str), $alpha['c']));
                    $t = strlen(str_replace(' ', '', $str));

                    $new = ($cnt == 0) 
                        ? array('v' => $v, 'c' => $c, 't' => $t, 'm' => ($t%2) ? $v * 1.5 : $c) 
                        : array('v' => $v, 'c' => $c, 't' => $t);

                    $this->digits[$i][$cnt][] = $new;
                }
                $cnt++;
            }
            $i++;
        }
        $h=$a=0;
        foreach($this->digits as &$etc) {
            foreach($etc[0] as &$r){

                foreach($etc[1] as $k) {
                foreach($k as $x=>$y) {
                    $tmp[$h] = (gcd($y,$r['t']) != 1) ? ++$a:'';
                }
                    $tmp[$h] = $r['m']*$a*1.5;
                    $h++;
                    $a=0;
                }$h=0;

            $r['f'] = $tmp;
            $tmp='';
            }

        } 
    foreach($this->digits as &$u){unset($u[1]);}
    } 
  • 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-05-25T06:36:22+00:00Added an answer on May 25, 2026 at 6:36 am

    judging by your use of the public identifier, I would guess your two functions are in a class.

    To refer to methods on the same object, use $this->methodname()

    from your code:

    $tmp[$h] = (gcd($y,$r['t']) != 1) ? ++$a:'';
    

    should be:

    $tmp[$h] = ($this->gcd($y,$r['t']) != 1) ? ++$a:'';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access a view inside a splitter from my mainframe. At
I'm trying to access a config file from a a servlet inside of .war-file.
Trying to access a property from the parent page on my user control. Here's
I'm trying to access YouTube from within an iOS app, but the iOS SDK
Im trying to access a web service from a remote computer. I managed to
I am trying to access Outlook 2007 from C#. I have installed the PIA
I am trying to access Facebook from Python :D I want to fetch some
I'm trying to access 1.20163 from the following: 1 British Pound Sterling = 1.20163
I am trying to access the outer class variable cell[i][j] from the inner class
Im trying to access some variables from the parent in a child mc. Parent

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.