How to Display multiple data using preg match?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • irfanmodan
    New Member
    • Jan 2011
    • 20

    How to Display multiple data using preg match?

    Hello Everyone...

    i have one issue.please help me

    My name {is} and.i {am} a php {developer}..ho w to display value within brecket '{.}'... also that value will be used to fetch value from the database

    i use below code but it is display only one value...

    Code:
    $message="My name {is} abd.i {am} a php {developer}.";
    preg_match("/\{([^{}]+)\}/", $message,$matches);
    	$find=$matches[0];
    	$path=getonefielddata("select path from tbl_plugin where field='$find'");
    	return str_replace("$find",$path,$message);
    But I want to use all the value to fetch the data from database..so how to display multiple value...

    sorry for my worst english...pleas e Help me...

    Thanks in advance..
    Irfan Modan
    Last edited by Dormilich; Apr 13 '11, 11:23 PM. Reason: please use [CODE] [/CODE] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you use preg_match_all( ).

    Comment

    • irfanmodan
      New Member
      • Jan 2011
      • 20

      #3
      Thanks Dormilich...
      Its work....

      Thank you very much

      Comment

      Working...