explode

MySQL (exploding/matching array)

Question1: MySQL table id | array 1 | 1,2,3 2 | 2 3 | 2,3 4 | 4,5,6 $_GET['id'] = 2; $a = mysql_query("SELECT * FROM `table` WHERE `array` ??? '$_GET[id]'"); In this step, I want to run through the entire array and see if it matches with the $_GET['id'], so it should output: ids: 1,2,3 Question2: MySQL table id | array 1 | ...

Turn X arrays into a single array

I want to change the format of this array to match another one. One was pulled from a database, and the other was made using space delimted user input and then explode(); So here are the arrays I want to change, this is from the database (mysql_fetch_array). It grabs the single field from all rows. Array ( [name] => daniel ) Arr...

help using php explode () and organizing output

Can someone pls show me how to map this correctly? I am trying to understand how to use php explode() and organizing the values in a way that I can retrieve and print them in some organized matter. For each record I want to put a name=value in a particular bucket. I have (7) max buckets per record. Sometimes I have records that won't fi...

Need help parsing some data in PHP

I need to be able to parse this sort of data in PHP: Acct: 1 email : [email protected] status : online -------------------------------------------------- Acct: 2 email : [email protected] status : banned -------------------------------------------------- Acct: 3 signedupname : SomeUsername ...

PHP List Explode Variable

Using PHP, I'm trying to give each specific text its own variable. I believe this can be achieved by using the explode list function in php. Something similar to the code below: list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data); However, the above code separates the text by using a colon (:). The text I'd lik...

Removing any (first, middle, last, single) item in a CSV list via PHP's explode / implode

$pieces = explode(",", $userList); $key=array_search($deleteuser, $pieces); if(FALSE !== $key) { unset($pieces[$key]); } else return FALSE; $userList = implode(",", $pieces); I'm looking for inputs into how to rework this code to remove an element from a CSV list. The user should exist in this system and it should work fine e...

PHP: combine text after explode

Using explode I broke up the text into pieces, then us the foreach to look for a few thing in the text. $pieces = explode(' ', $text); foreach ($pieces as $piece) { Some Modification of the piece } My questions so how can I put those pieces back together? So I can wordwrap the text. Some like this: piece 1 + piece 2 + etc ...

How to explode array and assign chunks to respective checkbox fields?

Hi, Following situation: I stored a checkbox array with implode in a mysql table field. Now, in order to update the checkboxes, I want to read the table field content, explode it into its parts and assign it to the respective checkboxes. So far I managed to read out and explode the table field content into different chunks, my difficul...

Multiple explode characters with comma and - (hyphen)

I want to explode a string for all: whitespaces (\n \t etc) comma hyphen (small dash). Like this >> - But this does not work: $keywords = explode("\n\t\r\a,-", "my string"); How to do that? ...

PHP: Seperate one field in two.

As many recommend me to seperate firstname and lastname instead of "full_name" with everything in, how can i seperate them to each variables, so if you example type in the field: "Dude Jackson" then "dude" gets in $firstname and Jackson in the $lastname. ...

splitting string by €-symbol with PHP won't work!?

hi there! i got this crappy website i need to parse and the html-element i need to get the contents of contains "€" symbols. the actual html of this page looks like this: <td>Mais-Lauch-R&ouml;sti <font color=#000000 size=1>(1,2,9,11)</font> mit Paprikasauce <font color=#000000 size=1>(3,9)</font><nobr><b> 2,10 &euro;</b></nobr><br/>.....

How do I change the delimiter of a list?

$variable = 'one, two, three'; How can I replace the commas between words with <br>? $variable should become: one<br> two<br> three ...

[php] Split string and get delimiter as return as well.

I would like to split a string by an array of delimiters, and also get feedback what the delimiter was. Example: $mystring = 'test+string|and|hello+word'; $result = preg_split('/\+,|/+', $mystring); I would like an array as return with something like this: $return[0] = array('test','+'); $return[1] = array('string','|'); thnx in adv...

Explode a string to an array

Probably easy to do but I can't seem to generate the correct regex. Say I have this string $string = '<h2>Header 1</h2><p>ahs da sdka dshk asd haks</p><img src="http://dummyimage.com/100x100/" width="100" height="100" alt="Alt" /><h2>Header 2</h2><p>asdkhas daksdha kd ahs</p><em>Lame</em><p>trhkbasd akhsd ka dkhas</p><h2>Header 3</h2><...

Problems trying to explode a string

I am trying to split a text into an array using explode, but for some reason that does not work when the text is coming from a posted form. If I run explode('|§|', 'qwe|§|asd|§|zxc'); I will get an array like: Array ( [0] => qwe [1] => asd [2] => zxc ) BUT If this input text comes from a form define like: ...

jQuery Explode changes fonts while exploding, how do I stop this?

Go to http://hartford.uconn.edu/scholarships/ click on any name, then click on "close" button which will show you that while "exploding" the fonts change from default "Trebuchet MS/ Trebuchet" to "Times New Roman". I have tried defining body {font-family:"Trebuchet MS", Trebuchet;} and defining other classes and change jQuery widget clas...

Grab the video ID only from youtube's URLs

How can I grab the video ID only from the youtube's URLs? For instance, http://www.youtube.com/watch?v=aPm3QVKlBJg sometime the URLs contain other information after the 'v' like http://www.youtube.com/watch?v=Z29MkJdMKqs&amp;feature=grec_index but I don't want the other info, just video ID. I only can think of using explod...