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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:18:42+00:00 2026-05-15T03:18:42+00:00

I get the above error when calling this code: <? class Test1 extends Core

  • 0

I get the above error when calling this code:

<?
class Test1 extends Core {
function home(){
?>
This is the INDEX of test1
<?
}
function test2(){
echo $this->uri->get_segment(1); //this is where the error comes from
?>
This is the test2 of test1 testing URI
<?
}
}
?>

I get the error where commentated.

This class extends this class:

<?php
class Core {

public function start()
{
require("funk/funks/libraries/uri.php");
$this->uri = new uri();
require("funk/core/loader.php");
$this->load = new loader();

if($this->uri->get_segment(1) != "" and file_exists("funk/pages/".$this->uri->get_segment(1).".php")){
include("funk/pages/". $this->uri->get_segment(1).".php");
$var = $this->uri->get_segment(2);
if ($var != ""){
$home= $this->uri->get_segment(1);
$Index= new $home();
$Index->$var();


}else{
$home= $this->uri->get_segment(1);
$Index = new $home();
$Index->home();

}

}elseif($this->uri->get_segment(1) and ! file_exists("funk/pages/".$this->uri->get_segment(1).".php")){

echo "404 Error";

}else{
include("funk/pages/index.php");
$Index = new Index();
$Index->home();
//$this->Index->index();


echo "<!--This page was created with FunkyPHP!-->";
}
}
}
?>

And here is the contents of uri.php:

<?php
class uri
{
    private $server_path_info = '';
    private $segment = array();
    private $segments = 0;

    public function __construct()
    {
        $segment_temp = array();
        $this->server_path_info = preg_replace("/\?/", "", $_SERVER["PATH_INFO"]);
        $segment_temp = explode("/", $this->server_path_info);
        foreach ($segment_temp as $key => $seg)
        {
            if (!preg_match("/([a-zA-Z0-9\.\_\-]+)/", $seg) || empty($seg)) unset($segment_temp[$key]);
        }
        foreach ($segment_temp as $k => $value)
        {
            $this->segment[] = $value;
        }
        unset($segment_temp);
        $this->segments = count($this->segment);
    }

    public function segment_exists($id = 0)
    {
        $id = (int)$id;
        if (isset($this->segment[$id])) return true;
        else return false;
    }

    public function get_segment($id = 0)
    {
    $id--;
        $id = (int)$id;
        if ($this->segment_exists($id) === true) return $this->segment[$id];
        else return false;
    }
}
?>

i have asked a similar question to this before but the answer does not apply here.

I have rewritten my code 3 times to KILL and Delimb this godforsaken error! but nooooooo….

EDIT:
I have changed the core class to add __construct:

<?php
class Core {
function __construct(){
require("funk/funks/libraries/uri.php");
$this->uri = new uri();
require("funk/core/loader.php");
$this->load = new loader();
}

public function start()
{

if($this->uri->get_segment(1) != "" and file_exists("funk/pages/".$this->uri->get_segment(1).".php")){
include("funk/pages/". $this->uri->get_segment(1).".php");
$var = $this->uri->get_segment(2);
if ($var != ""){
$home= $this->uri->get_segment(1);
$Index= new $home();
$Index->$var();


}else{
$home= $this->uri->get_segment(1);
$Index = new $home();
$Index->home();

}

}elseif($this->uri->get_segment(1) and ! file_exists("funk/pages/".$this->uri->get_segment(1).".php")){

echo "404 Error";

}else{
include("funk/pages/index.php");
$Index = new Index();
$Index->home();
//$this->Index->index();


echo "<!--This page was created with FunkyPHP!-->";
}
}
}
?>

but now it says: Cannot redeclare class uri in /home/afsadad/public_html/private/funkyphp/funk/funks/libraries/uri.php on line 3

  • 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-15T03:18:43+00:00Added an answer on May 15, 2026 at 3:18 am

    You are requiring a classfile on line three… use require_once(), or a class autoloading function.

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

Sidebar

Ask A Question

Stats

  • Questions 415k
  • Answers 415k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer SELECT Category, COUNT(*) AS Total , (COUNT(*) / (SELECT COUNT(*)… May 15, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer LEFT JOIN... SELECT a.InstanceID, b.field1, d.field4 FROM instances AS a… May 15, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer I solved my issue as I was using wampserver2.0 and… May 15, 2026 at 9:06 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.