Return to Snippet

Revision: 42769
at March 10, 2011 07:17 by anagaiyahoocom


Initial Code
$uri = '';
$uri .= in_array('scheme', $parts)  ? (!empty($this->_scheme) ? $this->_scheme.'://' : '') : '';
$uri .= in_array('user', $parts)    ? $this->_user : '';
$uri .= in_array('pass', $parts)    ? (!empty ($this->_pass) ? ':' : '') .$this->_pass. (!empty ($this->_user) ? '@' : '') : '';
$uri .= in_array('host', $parts)    ? $this->_host : '';
$uri .= in_array('port', $parts)    ? (!empty ($this->_port) ? ':' : '').$this->_port : '';
$uri .= in_array('path', $parts)    ? $this->_path : '';
$uri .= in_array('query', $parts)    ? (!empty ($query) ? '?'.$query : '') : '';
$uri .= in_array('fragment', $parts)? (!empty ($this->_fragment) ? '#'.$this->_fragment : '') : '';

Initial URL

                                

Initial Description

                                

Initial Title
Building a String using Concatenation and Ternary Operator

Initial Tags

                                

Initial Language
PHP