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


PHP strval函数代码示例

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


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

示例1: test_reset

 public function test_reset()
 {
     $cycle = new Cycle('one', 'two');
     $cycle->next_value();
     $cycle->reset();
     $this->assertEquals('one', strval($cycle));
 }
开发者ID:pdeffendol,项目名称:tingle,代码行数:7,代码来源:CycleTest.php

示例2: buat_SEP

 public function buat_SEP()
 {
     $timezone = date_default_timezone_get();
     date_default_timezone_set('UTC');
     $timestamp = strval(time() - strtotime('1970-01-01 00:00:00'));
     //cari timestamp
     $signature = hash_hmac('sha256', '27952' . '&' . $timestamp, 'rsm32h1', true);
     $encoded_signature = base64_encode($signature);
     $http_header = array('Accept: application/json', 'Content-type: application/xml', 'X-cons-id: 27952', 'X-timestamp: ' . $timestamp, 'X-signature: ' . $encoded_signature);
     date_default_timezone_set($timezone);
     //nama variabel sesuai dengan nama di xml
     $noMR = $this->input->post('no_cm');
     $noKartu = $this->input->post('no_bpjs');
     $noRujukan = $this->input->post('no_sjp');
     $ppkRujukan = $this->input->post('ppk_rujukan');
     $jnsPelayanan = $this->input->post('pelayanan');
     $klsRawat = $this->input->post('kelas_pasien');
     $diagAwal = $this->input->post('nm_diagnosa');
     $poliTujuan = $this->input->post('nm_poli');
     $catatan = $this->input->post('catatan');
     $user = 'Administrator';
     $ppkPelayanan = '0601R001';
     $tglSep = date('Y-m-d H:i:s');
     $tglRujukan = date('Y-m-d H:i:s');
     $data = '<request><data><t_sep>' . '<noKartu>' . $noKartu . '</noKartu>' . '<tglSep>' . $tglSep . '</tglSep>' . '<tglRujukan>' . $tglRujukan . '</tglRujukan>' . '<noRujukan>' . $noRujukan . '</noRujukan>' . '<ppkRujukan>' . $ppkRujukan . '</ppkRujukan>' . '<ppkPelayanan>' . $ppkPelayanan . '</ppkPelayanan>' . '<jnsPelayanan>' . $jnsPelayanan . '</jnsPelayanan>' . '<catatan>' . $catatan . '</catatan>' . '<diagAwal>' . $diagAwal . '</diagAwal>' . '<poliTujuan>' . $poliTujuan . '</poliTujuan>' . '<klsRawat>' . $klsRawat . '</klsRawat>' . '<user>' . $user . '</user>' . '<noMR>' . $noMR . '</noMR>' . '</t_sep></data></request>';
     $ch = curl_init('http://api.asterix.co.id/SepWebRest/sep/create/');
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $result = curl_exec($ch);
     curl_close($ch);
     $sep = json_decode($result)->response;
     echo $sep;
 }
开发者ID:mahdidham,项目名称:rsbpjs,代码行数:35,代码来源:Ajax.php

示例3: save

 function save($formdata_element = array(), $field_header = '', $formcontent_item_array = array())
 {
     if (!empty($formdata_element[$field_header . '_input_value'])) {
         $formcontent_item_array['value'] = $formdata_element[$field_header . '_input_value'];
     }
     $temp_options = explode("\n", $formdata_element[$field_header . '_options']);
     foreach ($temp_options as $temp_option) {
         $temp_option_details = explode('=', $temp_option);
         $formcontent_item_array['options'][strval($temp_option_details[0])] = trim($temp_option_details[1]);
     }
     $formcontent_item_array['legend'] = $formdata_element[$field_header . '_legend'];
     $formcontent_item_array['id'] = $formdata_element[$field_header . '_input_id'];
     $formcontent_item_array['ghost'] = $formdata_element[$field_header . '_ghost'];
     $formcontent_item_array['ghost_value'] = $formdata_element[$field_header . '_ghost_value'];
     $formcontent_item_array['label_over'] = $formdata_element[$field_header . '_label_over'];
     $formcontent_item_array['hide_label'] = $formdata_element[$field_header . '_hide_label'];
     $formcontent_item_array['multiline_start'] = $formdata_element[$field_header . '_multiline_start'];
     $formcontent_item_array['multiline_add'] = $formdata_element[$field_header . '_multiline_add'];
     $formcontent_item_array['enable_dynamic_data'] = $formdata_element[$field_header . '_enable_dynamic_data'];
     $formcontent_item_array['data_path'] = $formdata_element[$field_header . '_data_path'];
     $formcontent_item_array['value_key'] = $formdata_element[$field_header . '_value_key'];
     $formcontent_item_array['text_key'] = $formdata_element[$field_header . '_text_key'];
     $formcontent_item_array['radios_over'] = $formdata_element[$field_header . '_radios_over'];
     $formcontent_item_array['title'] = $formdata_element[$field_header . '_input_title'];
     $formcontent_item_array['validations'] = $formdata_element[$field_header . '_validations'];
     $formcontent_item_array['smalldesc'] = $formdata_element[$field_header . '_instructions'];
     $formcontent_item_array['tooltip'] = $formdata_element[$field_header . '_tooltip'];
     $formcontent_item_array['type'] = $formdata_element['type'];
     return $formcontent_item_array;
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:30,代码来源:input_radio.php

示例4: testToString

 public function testToString()
 {
     $this->sut->addEnvironment('RACK_ENV=development');
     $this->sut->addEnvironment('SESSION_SECRET');
     $expected = "environment: \n" . "    - RACK_ENV=development\n" . '    - SESSION_SECRET';
     $this->assertEquals($expected, strval($this->sut));
 }
开发者ID:octante,项目名称:docker-compose-bundle,代码行数:7,代码来源:DockerComposeEnvironmentTest.php

示例5: store

 public function store($id, $name, $strict = FALSE)
 {
     $namelen = strlen($name);
     if ($namelen < 1 || $namelen > 255) {
         throw new Exception('invalid-name', $name);
     }
     if (!ctype_digit(strval($id))) {
         throw new Exception('invalid-id', $id);
     }
     $namecheck = $this->byID($id);
     if ($namecheck == $name) {
         return TRUE;
     }
     if ($namecheck !== null) {
         $this->delete($id, $namecheck);
     }
     $idcheck = $this->byName($name);
     if ($id != $idcheck && $idcheck !== null) {
         if ($strict) {
             throw new Exception('name-taken');
         }
         $this->delete($idcheck, $name);
     }
     $table = $this->table();
     $db = $this->db();
     $sql = "INSERT INTO `{$table}` (`id`, `name`) VALUES (%i, %s)";
     if (!$strict) {
         $sql .= " ON DUPLICATE KEY UPDATE `id` = VALUES(`id`), `name` = VALUES(`name`)";
     }
     $rs = $db->execute($sql, $id, $name);
     return TRUE;
 }
开发者ID:Gaia-Interactive,项目名称:gaia_core_php,代码行数:32,代码来源:mysql.php

示例6: parseDataFromResponse

 /**
  * 解析从ListMultipartUpload接口的返回数据
  *
  * @return ListMultipartUploadInfo
  */
 protected function parseDataFromResponse()
 {
     $content = $this->rawResponse->body;
     $xml = simplexml_load_string($content);
     $encodingType = isset($xml->EncodingType) ? strval($xml->EncodingType) : "";
     $bucket = isset($xml->Bucket) ? strval($xml->Bucket) : "";
     $keyMarker = isset($xml->KeyMarker) ? strval($xml->KeyMarker) : "";
     $keyMarker = OssUtil::decodeKey($keyMarker, $encodingType);
     $uploadIdMarker = isset($xml->UploadIdMarker) ? strval($xml->UploadIdMarker) : "";
     $nextKeyMarker = isset($xml->NextKeyMarker) ? strval($xml->NextKeyMarker) : "";
     $nextKeyMarker = OssUtil::decodeKey($nextKeyMarker, $encodingType);
     $nextUploadIdMarker = isset($xml->NextUploadIdMarker) ? strval($xml->NextUploadIdMarker) : "";
     $delimiter = isset($xml->Delimiter) ? strval($xml->Delimiter) : "";
     $delimiter = OssUtil::decodeKey($delimiter, $encodingType);
     $prefix = isset($xml->Prefix) ? strval($xml->Prefix) : "";
     $prefix = OssUtil::decodeKey($prefix, $encodingType);
     $maxUploads = isset($xml->MaxUploads) ? intval($xml->MaxUploads) : 0;
     $isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : "";
     $listUpload = array();
     if (isset($xml->Upload)) {
         foreach ($xml->Upload as $upload) {
             $key = isset($upload->Key) ? strval($upload->Key) : "";
             $key = OssUtil::decodeKey($key, $encodingType);
             $uploadId = isset($upload->UploadId) ? strval($upload->UploadId) : "";
             $initiated = isset($upload->Initiated) ? strval($upload->Initiated) : "";
             $listUpload[] = new UploadInfo($key, $uploadId, $initiated);
         }
     }
     return new ListMultipartUploadInfo($bucket, $keyMarker, $uploadIdMarker, $nextKeyMarker, $nextUploadIdMarker, $delimiter, $prefix, $maxUploads, $isTruncated, $listUpload);
 }
开发者ID:rockuw,项目名称:aliyun-oss-php-sdk,代码行数:35,代码来源:ListMultipartUploadResult.php

示例7: isValid

 /**
  * Returns TRUE, if the given property ($value) is a valid array consistent of two equal passwords and their length
  * is between 'minimum' (defaults to 0 if not specified) and 'maximum' (defaults to infinite if not specified)
  * to be specified in the validation options.
  *
  * If at least one error occurred, the result is FALSE.
  *
  * @param mixed $value The value that should be validated
  * @return void
  * @throws \TYPO3\Flow\Validation\Exception\InvalidSubjectException
  */
 protected function isValid($value)
 {
     if (!is_array($value)) {
         throw new \TYPO3\Flow\Validation\Exception\InvalidSubjectException('The given value was not an array.', 1324641197);
     }
     $password = trim(strval(array_shift($value)));
     $repeatPassword = trim(strval(array_shift($value)));
     $passwordNotEmptyValidator = new \TYPO3\Flow\Validation\Validator\NotEmptyValidator();
     $passwordNotEmptyValidatorResult = $passwordNotEmptyValidator->validate($password);
     $repeatPasswordNotEmptyValidator = new \TYPO3\Flow\Validation\Validator\NotEmptyValidator();
     $repeatPasswordNotEmptyValidatorResult = $repeatPasswordNotEmptyValidator->validate($repeatPassword);
     if ($passwordNotEmptyValidatorResult->hasErrors() === TRUE && $repeatPasswordNotEmptyValidatorResult->hasErrors() === TRUE) {
         if (!isset($this->options['allowEmpty']) || isset($this->options['allowEmpty']) && intval($this->options['allowEmpty']) === 0) {
             $this->addError('The given password was empty.', 1324641097);
         }
         return;
     }
     if (strcmp($password, $repeatPassword) !== 0) {
         $this->addError('The passwords did not match.', 1324640997);
         return;
     }
     $stringLengthValidator = new \TYPO3\Flow\Validation\Validator\StringLengthValidator(array('minimum' => $this->options['minimum'], 'maximum' => $this->options['maximum']));
     $stringLengthValidatorResult = $stringLengthValidator->validate($password);
     if ($stringLengthValidatorResult->hasErrors() === TRUE) {
         foreach ($stringLengthValidatorResult->getErrors() as $error) {
             $this->result->addError($error);
         }
     }
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:40,代码来源:PasswordValidator.php

示例8: isIban

 /**
  * Checks if given value is valid International Bank Account Number (IBAN).
  *
  * @param  mixed  $value
  * @return boolean
  */
 public static function isIban($value)
 {
     // build replacement arrays
     $iban_replace_chars = range('A', 'Z');
     foreach (range(10, 35) as $tempvalue) {
         $iban_replace_values[] = strval($tempvalue);
     }
     // prepare string
     $tempiban = strtoupper($value);
     $tempiban = str_replace(' ', '', $tempiban);
     // check iban length
     if (self::getIbanLength($tempiban) != strlen($tempiban)) {
         return false;
     }
     // build checksum
     $tempiban = substr($tempiban, 4) . substr($tempiban, 0, 4);
     $tempiban = str_replace($iban_replace_chars, $iban_replace_values, $tempiban);
     $tempcheckvalue = intval(substr($tempiban, 0, 1));
     for ($strcounter = 1; $strcounter < strlen($tempiban); $strcounter++) {
         $tempcheckvalue *= 10;
         $tempcheckvalue += intval(substr($tempiban, $strcounter, 1));
         $tempcheckvalue %= 97;
     }
     // only modulo 1 is iban
     return $tempcheckvalue == 1;
 }
开发者ID:intervention,项目名称:validation,代码行数:32,代码来源:Validator.php

示例9: to_money

 public function to_money($number, $do_encode = false)
 {
     if (!is_numeric($number)) {
         $number = $this->to_number($number);
     }
     if ($number === false) {
         return '';
     }
     $negative = '';
     if (strpos(strval($number), '-') !== false) {
         $negative = '-';
         $number = floatval(substr($number, 1));
     }
     $money = number_format($number, $this->currency['decimals'], $this->currency['decimal_separator'], $this->currency['thousand_separator']);
     if ($money == '0.00') {
         $negative = '';
     }
     $symbol_left = !empty($this->currency['symbol_left']) ? $this->currency['symbol_left'] . $this->currency['symbol_padding'] : '';
     $symbol_right = !empty($this->currency['symbol_right']) ? $this->currency['symbol_padding'] . $this->currency['symbol_right'] : '';
     if ($do_encode) {
         $symbol_left = html_entity_decode($symbol_left);
         $symbol_right = html_entity_decode($symbol_right);
     }
     return $negative . $symbol_left . $money . $symbol_right;
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:25,代码来源:currency.php

示例10: formHTML

 /**
  * Forms the HTML response from our prediction results.
  */
 private function formHTML($prediction, $encodedTeam)
 {
     //get the name of the other team
     $this->data["their_team"] = $this->League->getTeamName($encodedTeam);
     $this->data["their_code"] = strtolower($encodedTeam);
     $this->data["score"] = strval($prediction[0][0] . " : " . $prediction[1][0]);
     $this->data["our_game_average"] = $prediction[0][1];
     $this->data["their_game_average"] = $prediction[1][1];
     $this->data["our_10_game_average"] = $prediction[0][2];
     $this->data["their_10_game_average"] = $prediction[1][2];
     $this->data["our_game_average_against"] = $prediction[0][3];
     $this->data["their_game_average_against"] = $prediction[1][3];
     //get the html we're going to return
     if ($prediction[0][0] > $prediction[1][0]) {
         $this->data["win_lose"] = "Win";
         $this->data["message"] = "Go Cowboys!";
     } elseif ($prediction[0][0] < $prediction[1][0]) {
         $this->data["win_lose"] = "Lose";
         $this->data["message"] = "Oh no!";
     } else {
         $this->data["win_lose"] = "Tie";
         $this->data["message"] = "Almost had 'em Cowboys!";
     }
     return $this->parser->parse('_prediction', $this->data, true);
 }
开发者ID:COMP4711Cowboys,项目名称:Project,代码行数:28,代码来源:Prediction.php

示例11: rgbToHex

function rgbToHex($red, $green, $blue, $format = false)
{
    $red = intval($red);
    $green = intval($green);
    $blue = intval($blue);
    if ($red >= 0 && $red <= 255 && $green >= 0 && $green <= 255 && $blue >= 0 && $blue <= 255) {
        $redhex = strval(dechex($red));
        $greenhex = strval(dechex($green));
        $bluehex = strval(dechex($blue));
        if (strlen($redhex) < 2) {
            $redhex = strval("0" . $redhex);
        }
        if (strlen($greenhex) < 2) {
            $greenhex = strval("0" . $greenhex);
        }
        if (strlen($bluehex) < 2) {
            $bluehex = strval("0" . $bluehex);
        }
        if ($format) {
            return "#" . $redhex . $greenhex . $bluehex;
        } else {
            return $redhex . $greenhex . $bluehex;
        }
    } else {
        return false;
    }
}
开发者ID:jonathanherrmannengel,项目名称:tools-php-color-converter,代码行数:27,代码来源:ccverter.php

示例12: testPages

 public function testPages()
 {
     $params = array('title' => 'My test page', 'content_type' => 'page', 'is_active' => 1);
     //saving
     $parent_page = save_content($params);
     $page_link = content_link($parent_page);
     $params = array('title' => 'My test sub page', 'content_type' => 'page', 'parent' => $parent_page, 'is_active' => 1);
     $sub_page = save_content($params);
     //getting
     $params = array('parent' => $parent_page, 'content_type' => 'page', 'single' => true, 'is_active' => 1);
     $get_sub_page = get_content($params);
     $sub_page_parents = content_parents($get_sub_page['id']);
     //clean
     $delete_parent = delete_content($parent_page);
     $delete_sub_page = delete_content($sub_page);
     //PHPUnit
     $this->assertEquals(true, in_array($parent_page, $sub_page_parents));
     $this->assertEquals(true, strval($page_link) != '');
     $this->assertEquals(true, intval($parent_page) > 0);
     $this->assertEquals(true, intval($sub_page) > 0);
     $this->assertEquals(true, is_array($get_sub_page));
     $this->assertEquals(true, is_array($delete_parent));
     $this->assertEquals(true, is_array($delete_sub_page));
     $this->assertEquals('My test sub page', $get_sub_page['title']);
     $this->assertEquals($sub_page, $get_sub_page['id']);
 }
开发者ID:microweber,项目名称:microweber,代码行数:26,代码来源:ContentTest.php

示例13: run

 public function run()
 {
     $whereGeo = array();
     //$this->getGeoQuery($_POST);
     $where = array('geo' => array('$exists' => true));
     $where = array_merge($where, $whereGeo);
     $events = PHDB::find(PHType::TYPE_EVENTS, $where);
     foreach ($events as $event) {
         //dans le cas où un événement n'a pas de position geo,
         //on lui ajoute grace au CP
         //il sera visible sur la carte au prochain rechargement
         if (!isset($event["geo"])) {
             $cp = $event["location"]["address"]["addressLocality"];
             $queryCity = array("cp" => strval(intval($cp)), "geo" => array('$exists' => true));
             $city = Yii::app()->mongodb->cities->findOne($queryCity);
             //->limit(1)
             if ($city != null) {
                 $newPos = array('geo' => array("@type" => "GeoCoordinates", "longitude" => floatval($city['geo']['coordinates'][0]), "latitude" => floatval($city['geo']['coordinates'][1])), 'geoPosition' => $city['geo']);
                 Yii::app()->mongodb->events->update(array("_id" => $event["_id"]), array('$set' => $newPos));
             }
         }
     }
     $events["origine"] = "ShowLocalEvents";
     Rest::json($events);
     Yii::app()->end();
 }
开发者ID:CivicTechFR,项目名称:PixelHumain,代码行数:26,代码来源:ShowLocalEventsAction.php

示例14: styleJsonEncode

function styleJsonEncode($var)
{
    switch (gettype($var)) {
        case 'boolean':
            return $var ? 'true' : 'false';
        case 'NULL':
            return 'null';
        case 'integer':
            return (int) $var;
        case 'double':
        case 'float':
            return (double) $var;
        case 'string':
            return '"' . addslashes(str_replace(array("\r\n", "\n", "\r", "\t"), array('<br />', '<br />', '<br />', ''), $var)) . '"';
        case 'array':
            if (count($var) && array_keys($var) !== range(0, sizeof($var) - 1)) {
                $properties = array();
                foreach ($var as $name => $value) {
                    $properties[] = styleJsonEncode(strval($name)) . ':' . styleJsonEncode($value);
                }
                return '{' . join(',', $properties) . '}';
            }
            $elements = array_map('pwJsonEncode', $var);
            return '[' . join(',', $elements) . ']';
    }
    return false;
}
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:27,代码来源:changestyle.php

示例15: ajax_query

 function ajax_query()
 {
     // options
     $options = acf_parse_args($_POST, array('post_id' => 0, 's' => '', 'field_key' => '', 'nonce' => ''));
     // load field
     $field = acf_get_field($options['field_key']);
     if (!$field) {
         die;
     }
     // vars
     $r = array();
     $s = false;
     // search
     if ($options['s'] !== '') {
         // search may be integer
         $s = strval($options['s']);
         // strip slashes
         $s = wp_unslash($s);
     }
     // loop through choices
     if (!empty($field['choices'])) {
         foreach ($field['choices'] as $k => $v) {
             // if searching, but doesn't exist
             if ($s !== false && stripos($v, $s) === false) {
                 continue;
             }
             // append
             $r[] = array('id' => $k, 'text' => strval($v));
         }
     }
     // return JSON
     echo json_encode($r);
     die;
 }
开发者ID:SayenkoDesign,项目名称:bushcooking.com,代码行数:34,代码来源:select.php


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