当前位置: 首页>>代码示例>>PHP>>正文


PHP strrev函数代码示例

本文整理汇总了PHP中strrev函数的典型用法代码示例。如果您正苦于以下问题:PHP strrev函数的具体用法?PHP strrev怎么用?PHP strrev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了strrev函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: convertToCurrency

function convertToCurrency($uang)
{
    $number = (string) $uang;
    $numberLength = strlen($number);
    $numberArray = array();
    $currencyArray = array();
    $currency = "";
    for ($i = 0; $i < $numberLength; $i++) {
        array_push($numberArray, $number[$i]);
    }
    $j = $numberLength - 1;
    $k = $numberLength - 1;
    for ($i = 0; $i <= $j; $i++) {
        $currencyArray[$i] = $numberArray[$k];
        $k--;
    }
    $count = 0;
    for ($i = 0; $i < sizeof($currencyArray); $i++) {
        if ($count % 3 == 0 && $count != 0) {
            $currency = $currency . ".";
        }
        $currency = $currency . $currencyArray[$i];
        $count++;
    }
    return strrev($currency);
}
开发者ID:sagaekakristi,项目名称:ppla02,代码行数:26,代码来源:index.blade.php

示例2: crypt

 /**
  * algo($mdp) algo
  * Ex : 'jean-paul' -> '5ORJpIwFYJlCIBbBoB'
  * @param STR $mdp
  * @return STR
  */
 public static function crypt($mdp)
 {
     $arr1 = str_split($mdp);
     $arr2 = array();
     $count = count($arr1);
     $lettre = array();
     for ($i = 65; $i <= 90; $i++) {
         $lettre[] = chr($i);
     }
     for ($i = 48; $i <= 57; $i++) {
         $lettre[] = chr($i);
     }
     for ($i = 97; $i <= 122; $i++) {
         $lettre[] = chr($i);
     }
     $code_int1 = '';
     for ($i = 0; $i < $count; $i++) {
         $arr1[$i] = ord($arr1[$i]);
         $arr2[$i] = intval(pow($i + 10, 4) * ($i + 7) / $arr1[$i]);
         $arr2[$i] = str_pad($arr2[$i], 6, "001", STR_PAD_LEFT);
         $arr3[$i] = str_split($arr2[$i], 3);
         $a = $arr3[$i][0] % 61;
         $b = $arr3[$i][1] % 61;
         $code_int1 .= $lettre[$a];
         $code_int1 .= $lettre[$b];
     }
     $code_int2 = strrev($code_int1);
     return $code_int2;
 }
开发者ID:pecqueurS,项目名称:hylacore,代码行数:35,代码来源:Encryptor.php

示例3: inverse

 private function inverse($text, $inverse = 1)
 {
     if ($inverse == 1) {
         $text = strrev($text);
     }
     return $text;
 }
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:7,代码来源:ean13.barcode.php

示例4: bytes2double

function bytes2double($number, $MNO, $STEP)
{
    //    echo 'Number has '.strlen($number).' bytes = '.$number.'<br/>';
    //переворачиваем строку
    $number = strrev($number);
    //создаем массив
    $mas = NULL;
    for ($i = 0; $i < 8; $i++) {
        $mas[$i] = sprintf("%08b", ord($number[$i]));
    }
    //    var_dump($mas);
    //создаем 64 битную строку
    $s = implode('', $mas);
    //    echo 'S = '.$s.'<br/>';
    //разделяем на биты знака, экспоненты и мантиссы
    $znak = substr($s, 0, 1);
    //    echo 'ZNAK = '.$znak.'<br/>';
    $exp = substr($s, 1, 11);
    //    echo 'EXP = '.bindec($exp).'<br/>';
    $mant = substr($s, 12, 52);
    //    echo 'MANT = '.bindec($mant).'<br/>';
    //находим множители
    $a = pow(-1, bindec($znak));
    //    echo 'A = '.$a.'<br/>';
    $b = pow(2, bindec($exp) - $STEP - 1023);
    //    echo 'B = '.$b.'<br/>';
    $c = 1 + bindec($mant) / pow(2, 52);
    //    echo 'C = '.$c.'<br/>';
    //считаем результат
    //    echo 'RESULT = '.($a*$b*$c*$MNO).'<br/>';
    return $a * $b * $c * $MNO;
}
开发者ID:vokson,项目名称:scad.local,代码行数:32,代码来源:func.php

示例5: getSeed

 /**
  * Return a seed value for the srand() function
  *
  * @deprecated Since 1.3.0, as this is not required since PHP 4.2.0.
  *
  * @return The resulting seed value
  */
 public static function getSeed()
 {
     $factor = 95717;
     // prime
     list($usec, $sec) = explode(" ", microtime());
     return (double) strrev($usec * $factor / M_PI);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:14,代码来源:RandomUtil.php

示例6: testMultipleFiles

 public function testMultipleFiles()
 {
     file_put_contents('static://foo', $this->sourceText);
     file_put_contents('static://bar', strrev($this->sourceText));
     $this->assertEquals($this->sourceText, file_get_contents('static://foo'));
     $this->assertEquals(strrev($this->sourceText), file_get_contents('static://bar'));
 }
开发者ID:evanjt,项目名称:core,代码行数:7,代码来源:staticstream.php

示例7: SetEncryption

 public function SetEncryption()
 {
     $this->iv = mcrypt_create_iv(mcrypt_get_iv_size(self::ENCRYPTION_TYPE, self::ENCRYPTION_MODE), MCRYPT_DEV_URANDOM);
     $this->encryptionKey = strrev(Config::Init($this->app)->Get(\Puzzlout\Framework\Enums\AppSettingKeys::EncryptionKey));
     $this->hashSalt = strrev(Config::Init($this->app)->Get(\Puzzlout\Framework\Enums\AppSettingKeys::PasswordSalt));
     return $this;
 }
开发者ID:Puzzlout,项目名称:FrameworkMvcLegacy,代码行数:7,代码来源:Protect.php

示例8: tel

 /**
  * Converts strings of integers into more readable telephone format
  *
  * By default, the ITU-T format will automatically be used.
  * However, one of the allowed unit types may also be used instead.
  *
  * @param   integer  $number       The integers in a phone number with dot separated country code
  *                                 ccc.nnnnnnn where ccc represents country code and nnn represents the local number.
  * @param   string   $displayplan  The numbering plan used to display the numbers.
  *
  * @return  string  The formatted telephone number.
  *
  * @see     JFormRuleTel
  * @since   1.6
  */
 public static function tel($number, $displayplan)
 {
     $number = explode('.', $number);
     $countrycode = $number[0];
     $number = $number[1];
     if ($displayplan == 'ITU-T' || $displayplan == 'International' || $displayplan == 'int' || $displayplan == 'missdn' || $displayplan == null) {
         $display[0] = '+';
         $display[1] = $countrycode;
         $display[2] = ' ';
         $display[3] = implode(str_split($number, 2), ' ');
     } elseif ($displayplan == 'NANP' || $displayplan == 'northamerica' || $displayplan == 'US') {
         $display[0] = '(';
         $display[1] = substr($number, 0, 3);
         $display[2] = ') ';
         $display[3] = substr($number, 3, 3);
         $display[4] = '-';
         $display[5] = substr($number, 6, 4);
     } elseif ($displayplan == 'EPP' || $displayplan == 'IETF') {
         $display[0] = '+';
         $display[1] = $countrycode;
         $display[2] = '.';
         $display[3] = $number;
     } elseif ($displayplan == 'ARPA' || $displayplan == 'ENUM') {
         $number = implode(str_split(strrev($number), 1), '.');
         $display[0] = '+';
         $display[1] = $number;
         $display[2] = '.';
         $display[3] = $countrycode;
         $display[4] = '.e164.arpa';
     }
     $display = implode($display, '');
     return $display;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:48,代码来源:tel.php

示例9: isValid

 /**
  * Defined by Zend_Validate_Interface
  *
  * Returns true if and only if $value contains a valid barcode
  *
  * @param  string $value
  * @return boolean
  */
 public function isValid($value)
 {
     $valueString = (string) $value;
     $this->_setValue($valueString);
     if (strlen($valueString) !== 13) {
         $this->_error(self::INVALID_LENGTH);
         return false;
     }
     $barcode = strrev(substr($valueString, 0, -1));
     $oddSum = 0;
     $evenSum = 0;
     for ($i = 0; $i < 12; $i++) {
         if ($i % 2 === 0) {
             $oddSum += $barcode[$i] * 3;
         } elseif ($i % 2 === 1) {
             $evenSum += $barcode[$i];
         }
     }
     $calculation = ($oddSum + $evenSum) % 10;
     $checksum = $calculation === 0 ? 0 : 10 - $calculation;
     if ($valueString[12] != $checksum) {
         $this->_error(self::INVALID);
         return false;
     }
     return true;
 }
开发者ID:mnfjorge,项目名称:moip-php,代码行数:34,代码来源:Ean13.php

示例10: convert_base

/**
 * Converts base of numbers. Supports base 2 to 36.
 * Note: Native support exists http://php.net/base_convert.
 *
 * @author Jitendra Adhikari <jiten.adhikary@gmail.com>
 *
 * @param  string $num      Numeric string.
 * @param  int    $tobase   To base
 * @param  int    $frombase From base (defaults to 10)
 * 
 * @return string           The number with converted base
 * 
 * @throws InvalidArgumentException  If input string or base is invalid
 */
function convert_base($num, $tobase, $frombase = 10)
{
    if ($tobase == $frombase) {
        return $num;
    }
    $map = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    if ($tobase > strlen($map) or $tobase < 2 or $frombase > strlen($map) or $frombase < 2) {
        throw new \InvalidArgumentException('Given base not yet supported');
    }
    // Validate $num
    if (trim(strtoupper($num), substr($map, 0, $frombase))) {
        throw new \InvalidArgumentException(sprintf('%s is not valid base %s number', $num, $frombase));
    }
    // Adapt to base 10 (only for first go, not used by recursion)
    if (10 != $frombase) {
        $tmp = 0;
        foreach (str_split(strrev($num)) as $pow => $n) {
            $tmp += stripos($map, $n) * pow($frombase, $pow);
        }
        $num = $tmp;
    }
    if ($num < $tobase) {
        return $map[(int) $num];
    }
    return convert_base(floor($num / $tobase), $tobase) . $map[$num % $tobase];
}
开发者ID:adhocore,项目名称:dsa,代码行数:40,代码来源:base.php

示例11: match

 /**
  * Match sequences of three or more characters.
  *
  * @copydoc Match::match()
  */
 public static function match($password, array $userInputs = array())
 {
     $matches = array();
     $passwordLength = strlen($password);
     $sequences = self::LOWER . self::UPPER . self::DIGITS;
     $revSequences = strrev($sequences);
     for ($i = 0; $i < $passwordLength; $i++) {
         $pattern = false;
         $j = $i + 2;
         // Check for sequence sizes of 3 or more.
         if ($j < $passwordLength) {
             $pattern = substr($password, $i, 3);
         }
         // Find beginning of pattern and then extract full sequences intersection.
         if ($pattern && ($pos = strpos($sequences, $pattern)) !== false) {
             // Match only remaining password characters.
             $remainder = substr($password, $j + 1);
             $pattern .= static::intersect($sequences, $remainder, $pos + 3);
             $params = array('ascending' => true, 'sequenceName' => static::getSequenceName($pos), 'sequenceSpace' => static::getSequenceSpace($pos));
             $matches[] = new static($password, $i, $i + strlen($pattern) - 1, $pattern, $params);
             // Skip intersecting characters on next loop.
             $i += strlen($pattern) - 1;
         } elseif ($pattern && ($pos = strpos($revSequences, $pattern)) !== false) {
             $remainder = substr($password, $j + 1);
             $pattern .= static::intersect($revSequences, $remainder, $pos + 3);
             $params = array('ascending' => false, 'sequenceName' => static::getSequenceName($pos), 'sequenceSpace' => static::getSequenceSpace($pos));
             $matches[] = new static($password, $i, $i + strlen($pattern) - 1, $pattern, $params);
             $i += strlen($pattern) - 1;
         }
     }
     return $matches;
 }
开发者ID:chamathsilva,项目名称:VideoBayV2.0,代码行数:37,代码来源:SequenceMatch.php

示例12: it_supports_default_action

 function it_supports_default_action()
 {
     $this->setDefault(function ($value) {
         return strrev($value);
     })->shouldReturn($this);
     $this('some_value_to_match')->shouldReturn('hctam_ot_eulav_emos');
 }
开发者ID:alexeyshockov,项目名称:pattern-matcher,代码行数:7,代码来源:MatcherSpec.php

示例13: function_menu

 /**
  * ShopEx licence
  *
  * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
  * @license  http://ecos.shopex.com/license/gpl GPL License
  */
 function function_menu()
 {
     $shop_base = app::get('site')->router()->gen_url(array('app' => 'site', 'ctl' => 'sitemaps', 'act' => 'catalog'));
     $shop_base = substr($shop_base, 0, -strpos(strrev($shop_base), '.')) . 'xml';
     $html[] = "<a href='{$shop_base}' target='_blank'>sitemaps</a>";
     return $html;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:13,代码来源:menu.php

示例14: generateSIN

 function generateSIN($separator = ' ')
 {
     $validPrefix = array(1, 2, 3, 4, 5, 6, 7, 9);
     $sin = array_rand($validPrefix, 1);
     $length = 9;
     while (strlen($sin) < $length - 1) {
         $sin .= rand(0, 9);
     }
     $sum = 0;
     $pos = 0;
     $reversedSIN = strrev($sin);
     while ($pos < $length - 1) {
         $odd = $reversedSIN[$pos] * 2;
         if ($odd > 9) {
             $odd -= 9;
         }
         $sum += $odd;
         if ($pos != $length - 2) {
             $sum += $reversedSIN[$pos + 1];
         }
         $pos += 2;
     }
     $checkdigit = ((floor($sum / 10) + 1) * 10 - $sum) % 10;
     $sin .= $checkdigit;
     $sin1 = substr($sin, 0, 3);
     $sin2 = substr($sin, 3, 3);
     $sin3 = substr($sin, 6, 3);
     return $sin1 . $separator . $sin2 . $separator . $sin3;
 }
开发者ID:jkhaled,项目名称:fng-sin-tools,代码行数:29,代码来源:fngsin.class.php

示例15: Uploadpic

 /**
  * 上传图片
  */
 protected function Uploadpic($picdir = "")
 {
     $res['error'] = "";
     if (is_uploaded_file($_FILES['fileToUpload']['tmp_name'])) {
         $info = explode('.', strrev($_FILES['fileToUpload']['name']));
         //配置要上传目录地址
         $datadir = date("Y-m-d");
         $picdir = $picdir . "/" . $datadir;
         $picname = "user_" . intval($_REQUEST['project_id']) . "_" . time() . "." . strrev($info[0]);
         $fullname = $picdir . "/" . $picname;
         if (BaseTool::createABFolder($picdir)) {
             if (move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $fullname)) {
                 $res["msg"] = "success";
                 $res["dir"] = $datadir . "/" . $picname;
             } else {
                 $res["error"] = "上传失败";
             }
         } else {
             $res['error'] = "上传失败";
         }
     } else {
         $res['error'] = '上传的文件不存在';
     }
     return $res;
 }
开发者ID:bfyang5130,项目名称:zzl,代码行数:28,代码来源:AbsWechatController.php


注:本文中的strrev函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。