pmpro_getMatches

The Paid Memberships Pro pmpro getMatches function.

Description

pmpro_getMatches( $p, $s, (constant) $firstvalue = FALSE, (int) $n = 1 ); 

Parameters (4)

0. $p
The p.
1. $s
The s.
2. $firstvalue — Optional. (constant) => FALSE
The firstvalue.
3. $n — Optional. (int) => 1
The n.

Usage

  1. if ( !function_exists( 'pmpro_getMatches' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/functions.php'; 
  3.  
  4. // The p. 
  5. $p = null; 
  6.  
  7. // The s. 
  8. $s = null; 
  9.  
  10. // The firstvalue. 
  11. $firstvalue = FALSE; 
  12.  
  13. // The n. 
  14. $n = 1; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = pmpro_getMatches($p, $s, $firstvalue, $n); 
  18.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.php  
  1. function pmpro_getMatches($p, $s, $firstvalue = FALSE, $n = 1) 
  2. $ok = preg_match_all($p, $s, $matches); 
  3.  
  4. if(!$ok) 
  5. return false; 
  6. else 
  7. if($firstvalue) 
  8. return $matches[$n][0]; 
  9. else 
  10. return $matches[$n];