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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:23:47+00:00 2026-06-17T13:23:47+00:00

So here is my code: <?php function __autoload($className) { $paths = explode(PATH_SEPARATOR, get_include_path()); $file

  • 0

So here is my code:

<?php

function __autoload($className) {
    $paths = explode(PATH_SEPARATOR, get_include_path());
    $file = $className . '.php';
    foreach ($paths as $path) {
        $combined = $path . DIRECTORY_SEPARATOR . $file;
        if (file_exists($combined)) {
            echo $combined;
            include($combined);
            return;
        }
    }
}

$string = 'Koray';
$string = Framework\StringMethods::_normalize($string);
echo $string;
?>

The above file is called index.php.
There is a file called StringMethods.php in the folder under Framework directory..

So my question is here audoloader autoloads: .\Framework\StringMethods.php because I call:

$string = Framework\StringMethods.

so the $file variable actually is= FrameWork\StringMethods. And what I do is to add .php in the end an .\ in the beginning.

But how does Framework\StringMethods will behave in a Linus system? Isn’t the directory seperator: “/” in Linux?

So it will try to include: ./Framework\StringMethods.php

If correct, how to code better?

  • 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-17T13:23:49+00:00Added an answer on June 17, 2026 at 1:23 pm

    Can you try code bellow? Be careful for for folder/files names, because unix is case-sensitive.

    define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
    
    function __autoload($className) {
        $path = str_replace('\\', DIRECTORY_SEPARATOR, $className);
        $file = ROOT_PATH . $path . '.php';
        if (is_file($file)) {
            require_once($file);
        }
    }
    
    $string = 'Koray';
    $string = \Framework\StringMethods::_normalize($string);
    echo $string;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the code: print_table.php: ---------------- <?php function print_table($db) { foreach ($db->query(SELECT * FROM name_of_db)
I am completely stumped. Here is my php (CodeIgniter) code: function mod() { $uid
Here is the code: $('#sousmenu a').click (function (){ startSlideshow(<?php echo json_encode(glob(photos- .$_GET[folder]. /*.jpg));?>); return
my sample code is here include 'simple_html_dom.php'; function get_all_links($url){ global $host; $html = new
Here's my Zend code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function
I have 2 PHP files (both's output are same) First file code <?php function
here is my php code..... <?php function nicetime($date) { if(empty($date)) { return No date
Here is a code sample of PHP function which prints HTML links. For some
have a php code like this,(part of the php function here)going to convert it
$.getJSON(./data/revenue-item-data.php,{val:'val'},function(data){ $('#totalUnits').val(data[0].SUM(item_qty)); $('#totalAmounts').val(data[0].SUM(DISTINCT net_total)); }); Here is array I get for above code: [{SUM(item_qty):68,SUM(DISTINCT

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.