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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:44:41+00:00 2026-06-18T08:44:41+00:00

Code in native PHP: $href = phpUri::parse($target_url)->join($href); Code I tried in CI which is

  • 0

Code in native PHP:

$href = phpUri::parse($target_url)->join($href);

Code I tried in CI which is not working:

$CI->load->library('Phpuri', array($target_url));
$href = $CI->phpuri->parse($target_url);
$href = $CI->phpuri->join($href);

You can see the phpUri native library here. I’ve just changed the case of class name rest is same to make it work in CI. I am using this in another library so using the CI instance.

  • 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-18T08:44:42+00:00Added an answer on June 18, 2026 at 8:44 am

    CodeIgniter’s pattern is a singleton. The phpUri uses static calls. There is a great difference between them that I suggest you to familiarize with.

    The point here is that phpUri uses the static call parse which is requested from the class, not the object itself and as CodeIgniter is a singleton, it’s an object with sub-objects (said that for simplicity, read more about that). With that being said, the reason why this doesn’t work is that phpUri does not behave like an object and only produces(returns) objects after the static call:

    $href = phpUri::parse($target_url)->join($href);
    

    can be simplified to:

    $parsed = phpUri::parse($target_url);
    $href = $parsed->join($href);
    

    the first line is the static call which returns an object to $parsed variable and then you can play with that.

    In singleton, you can’t make a ‘classes parent’ by defining a class as an objects attribute. That’s why to use this library, you should rewrite all the static calls first.

    But it is much easier to write an abstraction layer library in CodeIgniter that uses static calls in it’s object’s non-static methods:

    class MyPhpUri {
        function parse($target_url) {
            return phpUri::parse($target_url);        
        }
    }
    

    Then in your library

    $CI =& get_instance();
    $CI->load->library('MyPhpUri');
    $href = $CI->myphpuri->parse($target_url)->join($var);
    

    That is what an abstract class is – the one that gives you an interface.

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

Sidebar

Related Questions

Can I build shared library from native code (.so file, to be used in
I have an android app which has native code. The native code needs to
I've tried several variations of ASP & PHP native & 3rd party mailer programs.
I have a native PHP function issue when I convert plain PHP code into
I am working on some legacy PHP code that holds a ton of in-line
I've tried the native way of uploading images with PHP, but my friend suggested
Is native code of browsers considered to be part of Layout engine (Rendering engine)
When my android application native code runs on NEON processor I'm taking advantage of
I read that Windows wp8 allows native code. So how then have ports such
I am using a cv::VideoCapture in native code and I am having issues with

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.