????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/strings/ |
Upload File : |
--TEST--
Testing rtrim() function
--FILE--
<?php
/* Testing for Error conditions */
/* Invalid Number of Arguments */
echo "\n *** Output for Error Conditions ***\n";
rtrim();
rtrim("", " ", 1);
/* Testing the Normal behaviour of rtrim() function */
echo "\n *** Output for Normal Behaviour ***\n";
var_dump ( rtrim("rtrim test \t\0 ") ); /* without second Argument */
var_dump ( rtrim("rtrim test " , "") ); /* no characters in second Argument */
var_dump ( rtrim("rtrim test ", NULL) ); /* with NULL as second Argument */
var_dump ( rtrim("rtrim test ", true) ); /* with boolean value as second Argument */
var_dump ( rtrim("rtrim test ", " ") ); /* with single space as second Argument */
var_dump ( rtrim("rtrim test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
var_dump ( rtrim("rtrim testABCXYZ", "A..Z") ); /* with characters range as second Argument */
var_dump ( rtrim("rtrim test0123456789", "0..9") ); /* with numbers range as second Argument */
var_dump ( rtrim("rtrim test$#@", "#@$") ); /* with some special characters as second Argument */
/* Use of class and objects */
echo "\n*** Checking with OBJECTS ***\n";
class string1 {
public function __toString() {
return "Object";
}
}
$obj = new string1;
var_dump( rtrim($obj, "tc") );
/* String with embedded NULL */
echo "\n*** String with embedded NULL ***\n";
var_dump( rtrim("234\x0005678\x0000efgh\xijkl\x0n1", "\x0n1") );
/* heredoc string */
$str = <<<EOD
us
ing heredoc string
EOD;
echo "\n *** Using heredoc string ***\n";
var_dump( rtrim($str, "ing") );
echo "Done\n";
?>
--EXPECTF--
*** Output for Error Conditions ***
Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d
Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d
*** Output for Normal Behaviour ***
string(10) "rtrim test"
string(13) "rtrim test "
string(18) "rtrim test "
string(18) "rtrim test "
string(10) "rtrim test"
string(11) "rtrim test "
string(10) "rtrim test"
string(10) "rtrim test"
string(10) "rtrim test"
*** Checking with OBJECTS ***
string(4) "Obje"
*** String with embedded NULL ***
string(22) "234 05678 00efgh\xijkl"
*** Using heredoc string ***
string(18) "us
ing heredoc str"
Done