Warning: Invalid argument supplied for foreach() in /home/jihswbiz/public_html/t6.gwilt.org/refDox.php on line 212
Docs-shift

 

ReLoad

Keys


Functions

arraybrowsercolorcookiedatetimeDBdebugdeviceDSTequiverrorflagsfontformatgeo
holidayhtmlisjsonmathparsePHPprintsearchsortstringtabletexttracetype
VOTDweatherxml

Function  shift   Lines 1884-1924 (40 lines)Added: 2021-02-11 file  utils.php   Last mod: Fri 2021-05-14 21:45:07

function shift $str$mode=)
        {
#-k     equiv string
#-      perform shift ops on a string, because I can't remember the stupid naming non-convention of PHP
#-p     $mode   - opt   - 0 = upshift
#-p                     - 1 = downshift
#-p                     - 2 = sentence (capitalize 1st word)
#-p                     - 3 = title (capitalize evry word)
#-p                     - 4 = name case (deals with Jean-Luc and O'Brien)
#-c     credit #4 jmarois@ca.ibm.com in https://www.php.net/manual/en/function.ucwords.php
#-d     2/11/21 Added

        
switch ($mode)
                {
default:
case 
0:         $str strtoupper $str );
                break;

case 
1:         $str strtolower $str );
                break;

case 
2:         $str ucfirst $str );
                break;

case 
3:         $str ucwords $str" \t\r\n\f\v" );
                break;

case 
4:         $str ucwords strtolower($str) );
                foreach ( array(
'-''\'') as $del )
                        {
                        if (
strpos($str$del) !== false)
                                {
                                
$str implode $delarray_map 'ucfirst'explode($del$str) ) );
                                }
                        }
                break;
                }

        return 
$str;
        }

?>