Jump to content

The bits of an array surrounded by " " marks


Recommended Posts

Hello... tearing my hair out trying to extract the contents of an array that looks a bit like this:

 

a:2:{i:0;s:5:"Spec1";i:1;s:5:"Spec6";} 

 

an array being carried over as the variable $ts7

 

its being sent by a wonderfully useful jquery selection list, but i dont know how to get the actual variables out of it.. in this case Spec1 and Spec6.

 

have tried variations along the lines of

 

<?php

if (preg_match("/"./"", $ts7, $ts7)) {

  echo "Match was found <br />";

  echo $ts7[0];

}

 

but to no avail..

any pointers gratefully received.. i'm rubbish at these but keen to improve, so any links to useful tutorials/sites also great would be!

Theoretically to match those values you'd use something more like...

 

'

#"[^"]+"#'

 

But I suspect there is a better method, whilst I don't recognise that format it seems very specific, it could be JSON or something similar.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.