Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8736

Re: split array and string from string (trust me it will make sense when you read)

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: split array and string from string (trust me it will make sense when you read)
Date 2013-03-19 09:06 -0400
Organization A noiseless patient Spider
Message-ID <ki9np5$2ll$3@dont-email.me> (permalink)
References <a9993724-7709-41e0-9412-02ed3056d12d@googlegroups.com>

Show all headers | View raw


On 3/19/2013 12:12 AM, CloudPress wrote:
> I have a string that consists of several key value pairs such as [key=value], a given key may appear more than once.
>
> For example a string of:
>
> "Hello world, [key=value] [key2=value1] This is just a test. [key=value2]"
>
> I want to do two things, one I want an easier way to view the key value pairs, I am thinking an array
>
> array ('key' => array ('value', 'value2'), 'key2' => 'value1');
>
> Secondly I want the key/value pairs removed from the string so I would get the array and a new string that would look like this:
>
> "Hello world, This is just a test."
>
> What would be the easiest way to accomplish this?
>

Maybe a regex?

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

split array and string from string (trust me it will make sense when you read) CloudPress <cloudpresshosting@gmail.com> - 2013-03-18 21:12 -0700
  Re: split array and string from string (trust me it will make sense when you read) CloudPress <cloudpresshosting@gmail.com> - 2013-03-18 21:17 -0700
  Re: split array and string from string (trust me it will make sense when you read) Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-19 09:06 -0400
    Re: split array and string from string (trust me it will make sense when you read) CloudPress <cloudpresshosting@gmail.com> - 2013-03-19 17:34 -0700
      Re: split array and string from string (trust me it will make sense when you read) Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-19 20:45 -0400
        Re: split array and string from string (trust me it will make sense when you read) CloudPress <cloudpresshosting@gmail.com> - 2013-03-19 17:56 -0700
          Re: split array and string from string (trust me it will make sense when you read) Christoph Becker <cmbecker69@gmx.de> - 2013-03-20 02:21 +0100
          Re: split array and string from string (trust me it will make sense when you read) Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-19 21:43 -0400

csiph-web