Re: Extracting data

From: Date: Tue, 27 Nov 2001 09:39:16 +0000
Subject: Re: Extracting data
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75758@lists.php.net to get a copy of this message
<?php $str = '#@data1#@data2#@data3#@'; $count = preg_match_all('/\#\@([\w\d]+?)(?=\#\@)/',$str,$results); var_dump($results); ?> Produces : array(2) { [0]=> array(3) { [0]=> string(7) "#@data1" [1]=> string(7) "#@data2" [2]=> string(7) "#@data3" } [1]=> array(3) { [0]=> string(5) "data1" [1]=> string(5) "data2" [2]=> string(5) "data3" } } Best regards, Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS ----- Original Message ----- From: "Joeri Vankelst" <joeri.vankelst@softhome.be> To: <php-general@lists.php.net> Sent: Tuesday, November 27, 2001 11:27 AM Subject: [PHP] Extracting data > Hi, > > I'm looking for a way to extract data from a single variable. > I'll explain: > > The variable contains somthing that look like: #@data1#@data2#@data3 > What I would like to do is check the data between the #@'s so I can compare > data1, 2 and 3 with a another variable. The next this I would like to be > able to do is count the #@'s so I can seen how many items there are in the > variable. > > Any help would be greatly appreciated! > > Joeri Vankelst > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#75758) next »