Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14343

[Solved] Automatically replace the first & with a ? question mark.

$
0
0
I have this code below which generates a query string for my url.

But I would like to know is there away that it could automatically replace the first & with a ? question mark.


PHP Code:
$url '';

if (
$this->input->get('directory')) {
 
  $pos strrpos($this->input->get('directory'), '/');

 
  if ($pos) {
 
     $url .= '&directory=' urlencode(substr($this->input->get('directory'), 0$pos));
 
  }
}

if (
$this->input->get('target')) {
 
   $url .= '&target=' $this->input->get('target'); 
}

if (
$this->input->get('thumb')) {
 
   $url .= '&thumb=' $this->input->get('thumb'); 



$data['parent'] = base_url('image_manager' $url); 

Viewing all articles
Browse latest Browse all 14343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>