3 // FPDI - Version 1.2.1
5 // Copyright 2004-2008 Setasign - Jan Slabon
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
21 if (!defined("PHP_VER_LOWER43"))
22 define("PHP_VER_LOWER43", version_compare(PHP_VERSION, "4.3", "<"));
26 * ensure that strspn works correct if php-version < 4.3
28 function _strspn($str1, $str2, $start=null, $length=null) {
29 $numargs = func_num_args();
31 if (PHP_VER_LOWER43 == 1) {
33 $str1 = substr($str1, $start, $length);
35 $str1 = substr($str1, $start);
39 if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
40 return strspn($str1, $str2);
41 } else if ($numargs == 3) {
42 return strspn($str1, $str2, $start);
44 return strspn($str1, $str2, $start, $length);
50 * ensure that strcspn works correct if php-version < 4.3
52 function _strcspn($str1, $str2, $start=null, $length=null) {
53 $numargs = func_num_args();
55 if (PHP_VER_LOWER43 == 1) {
57 $str1 = substr($str1, $start, $length);
59 $str1 = substr($str1, $start);
63 if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
64 return strcspn($str1, $str2);
65 } else if ($numargs == 3) {
66 return strcspn($str1, $str2, $start);
68 return strcspn($str1, $str2, $start, $length);