string functions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kanaps
Forum Newbie
Posts: 13
Joined: Tue Nov 23, 2004 9:23 am
Location: UK
Contact:

string functions

Post by kanaps »

Please advise on best sollucion / commands to use!

I have a pages with code like:

Code: Select all

//............a lot before........
   ....write(getUserInfo(''NEED TO GET THIS OUT'', '4', 0, '', 1, false, false, 0));
  document.write(' ї0/45]');
//--></SCRIPT>
            -<BR>
            <SCRIPT language=JavaScript type=text/javascript>
<!--
  document.write(getUserInfo('AND THIS TO', '4', 0, '', 1, false, false, 0));
  document.write(' &#1111;0/61]');
//--></SCRIPT>....
So what is the best way for geting "NEED TO GET THIS OUT" and 'AND THIS TO' if this lines alvays same and what I need to get is not..
Please advise what should I use (like str_replace etc.)

Thank you,
Kanaps
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

heres a start

Code: Select all

<?php

$hay = 'your html';

$pattern = '/getuserinfo\((.*?)\)/i';

preg_match_all($pattern, $hay, $matches);

print_r($matches);

?>
Post Reply