public function stripPadding($block, $data) {
    $pad = ord($data[($len = strlen($data)) - 1]);

    /* Check that what we have at the end of the string really is padding, and if it is remove it. */
    if ($pad && $pad < $block && preg_match('/' . chr($pad) . '{' . $pad . '}$/', $data)) {
      return substr($data, 0, -$pad);
    }
    return $data;
  }
public function stripPadding($block, $data) {
    $pad = ord($data[($len = strlen($data)) - 1]);

    /* Check that what we have at the end of the string really is padding, and if it is remove it. */
    if ($pad && $pad < $block && preg_match('/' . chr($pad) . '{' . $pad . '}$/', $data)) {
      return substr($data, 0, -$pad);
    }
    return $data;
  }
public function stripPadding ( $ block , $ data ) { $ pad = ord ( $ data [ ( $ len = strlen ( $ data ) ) - 1 ] ) ; /* Check that what we have at the end of the string really is padding, and if it is remove it. */ if ( $ pad && $ pad < $ block && preg_match ( '/' . chr ( $ pad ) . '{' . $ pad . '}$/' , $ data ) ) { return substr ( $ data , 0 , - $ pad ) ; } return $ data ; }
Strip PKCS7-padding.

@param integer $block
Block size.

@param string $data
Padded data.

@return string
Original data.
Strip PKCS7 - padding .