本文整理汇总了PHP中multiexplode函数的典型用法代码示例。如果您正苦于以下问题:PHP multiexplode函数的具体用法?PHP multiexplode怎么用?PHP multiexplode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了multiexplode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
function validate($text)
{
$z = array_filter(multiexplode($text), function ($i) {
return filter_var($i, FILTER_VALIDATE_EMAIL);
});
return $z;
}
示例2: multiexplode
function multiexplode($delimiters, $string)
{
$ary = explode($delimiters[0], $string);
array_shift($delimiters);
if ($delimiters != NULL) {
foreach ($ary as $key => $val) {
$ary[$key] = multiexplode($delimiters, $val);
}
}
return $ary;
}
示例3: tgl_jam_indo
function tgl_jam_indo($tgl_jam)
{
$rubah = gmdate($tgl_jam);
$cacah = multiexplode(array("-", " ", ":"), $rubah);
$tanggal = $cacah[2];
$bulan = bulan($cacah[1]);
$tahun = $cacah[0];
$jam = $cacah[3];
$menit = $cacah[4];
$detik = $cacah[5];
return $tanggal . ' ' . $bulan . ' ' . $tahun . ' ' . $jam . ':' . $menit . ':' . $detik;
}
示例4: spamcheck
function spamcheck($field)
{
$addresses = multiexplode(array(",", ";"), $field);
for ($i = 0; $i < count($addresses); $i++) {
//filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$addresses[$i] = filter_var($addresses[$i], FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if (!filter_var($addresses[$i], FILTER_VALIDATE_EMAIL)) {
return FALSE;
}
}
return TRUE;
}
示例5: decimal_lat_long
function decimal_lat_long($gps)
{
$position = multiexplode(array(' ', '\'', '"', ','), $gps);
$degree_lat = doubleval($position[0]);
$min_lat = doubleval($position[2]);
$sec_lat = doubleval($position[4]);
$decimal_lat = $degree_lat + $min_lat / 60 + $sec_lat / 3600;
$decimal_lat = round($decimal_lat, 6);
if ($position[6] == "S") {
$decimal_lat *= -1;
}
$degree_long = doubleval($position[8]);
$min_long = doubleval($position[10]);
$sec_long = doubleval($position[12]);
$decimal_long = $degree_long + $min_long / 60 + $sec_long / 3600;
$decimal_long = round($decimal_long, 6);
if ($position[14] == "W") {
$decimal_long *= -1;
}
return array($decimal_lat, $decimal_long);
}
示例6: multiexplode
*/
require_once 'logic.php';
function multiexplode($delimiters, $string)
{
$ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready);
return $launch;
}
//get input from index.php
if (isset($_POST['input'])) {
$input = $_POST['input'];
}
echo $input;
//Parse $input
$numbers = multiexplode(array("(", ")", "+", "-", "*", "/", "sqrt2", "sqrt3", "pow"), $input);
$operations = multiexplode(array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " "), $input);
$i = 0;
foreach ($operations as $a) {
if ($a == "") {
unset($operations[$i]);
array_values($operations);
}
if ($a == ".") {
unset($operations[$i]);
array_values($operations);
}
$i++;
}
//Reorder arrays. why? Because i can.
$numbers = array_values($numbers);
$operations = array_values($operations);
示例7: preg_replace
<?php
echo "equation: {$_POST['input']} <br>";
$string = $_POST['input'];
$num = preg_replace("/[^0-9]*/s", " ", $string);
function multiexplode($delimiters, $string)
{
$ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready);
return $launch;
}
$num = multiexplode(array("+", "-", "/", "*"), $string);
$j = 0;
for ($i = 0; $i < strlen($string); $i++) {
if ($string[$i] == '+') {
$num[$j + 1] = $num[$j] + $num[$j + 1];
$j++;
} else {
if ($string[$i] == '-') {
$num[$j + 1] = $num[$j] - $num[$j + 1];
$j++;
} else {
if ($string[$i] == '*') {
$num[$j + 1] = $num[$j] * $num[$j + 1];
$j++;
} else {
if ($string[$i] == '/') {
$num[$j + 1] = $num[$j] / $num[$j + 1];
$j++;
} else {
continue;
示例8: profanity_counter
function profanity_counter($textarea, $dirt = array())
{
$counter = 0;
$textArray = array();
//multi explode all the text to array
$textarea = multiexplode(array("|", " ", "//"), $textarea);
//create the loop to check
foreach ($textarea as $string) {
if (preg_match_all("/(" . implode('|', $dirt) . ")/", $string, $matches)) {
$counter += 1;
}
}
return (int) $counter;
}
示例9: notifiy_friends
$total = "http://www.youtube.com/embed/" . $Parse;
}
//create new login and profile if form success
if ($postsuccess) {
notifiy_friends($conn);
//echo "Link created!";
$err_post = "Submitted!";
//sql login
$sql_addpost = "INSERT INTO posts (User_ID, type, info)\n\t\tVALUES ({$_SESSION['SESS_LOGIN_ID']}, 'video', '{$total}')";
check_sql($sql_addpost, $conn);
$last_post = $conn->insert_id;
//check for tags------------------------------------------------------
if (isset($_POST['tags_video'])) {
$tlist = "video, " . $_POST['tags_video'];
$tag_list = test_input($tlist);
$exploded = multiexplode(array(",", " "), $tag_list);
foreach ($exploded as $tag_element) {
if ($tag_element != NULL) {
$sql_addpost2 = "INSERT INTO tags (Post_ID, Tag_label)\n\t\t\t\t\t\t\tVALUES ({$last_post}, '{$tag_element}')";
check_sql($sql_addpost2, $conn);
}
}
}
header("Location:index.php");
}
}
?>
</body>
</html>
示例10: sanitize
$date4 = sanitize($_POST["date4"]);
$reason = sanitize($_POST["request_reason"]);
$sql_date2 = $sql_date3 = $sql_date4 = "1969-01-01";
// Convert from MM-DD-YYYY to YYYY-MM-DD to follow the MySQL Date Format
$dateInput1 = multiexplode(array("-", "/"), $date1);
$sql_date1 = $dateInput1[2] . "-" . $dateInput1[0] . "-" . $dateInput1[1];
if (!empty($_POST["date2"])) {
$dateInput2 = multiexplode(array("-", "/"), $date2);
$sql_date2 = $dateInput2[2] . "-" . $dateInput2[0] . "-" . $dateInput2[1];
}
if (!empty($_POST["date3"])) {
$dateInput3 = multiexplode(array("-", "/"), $date3);
$sql_date3 = $dateInput3[2] . "-" . $dateInput3[0] . "-" . $dateInput3[1];
}
if (!empty($_POST["date4"])) {
$dateInput4 = multiexplode(array("-", "/"), $date4);
$sql_date4 = $dateInput4[2] . "-" . $dateInput4[0] . "-" . $dateInput4[1];
}
// echo "CALL insert_request('$first_name', '$last_name', '$sql_date1', '$sql_date2', '$sql_date3', '$sql_date4', '$reason')";
mysqli_query($link, "CALL insert_request('{$first_name}', '{$last_name}', '{$sql_date1}', '{$sql_date2}', '{$sql_date3}', '{$sql_date4}', '{$reason}')");
echo "<h3>The Day Off Request was sent successfully!</h3>";
die;
}
}
?>
<h1>Day Off Request</h1>
<p>The Day Off Request Form is to fill out the information for specific day you want to take a break. Once you submit the form, you will receive an e-mail from the one of the manager that determines if they accept or reject your request.</p>
<form class="form-horizontal day_request" method="POST">
<div class="form-group form-group-default">
示例11: simplexml_load_file
// counter
$url = "http://open.live.bbc.co.uk/weather/feeds/en/" . $weatherval . "/observations.rss";
// url to parse
$rss = simplexml_load_file($url);
// XML parser
function multiexplode($delimiters, $string)
{
$ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready);
return $launch;
}
$exploded = "";
foreach ($rss->channel->item as $item) {
if ($i < 1) {
// parse only 10 items
$exploded = multiexplode(array(",", ".", "|", ":"), $item->title);
//echo $exploded[3];
//$wethval2 = explode(':', $wethval2[1],-1);
// echo preg_replace('/[^a-zA-Z0-9_%\[().\]\\/-]/s', '', $exploded[3]);
//
// = preg_replace('/[^a-zA-Z0-9_%\[().\]\\/-]/s', '', $wethval2[5]);
}
$i++;
}
$exploded[3] = preg_replace('/[^a-zA-Z0-9_%\\[().\\]\\/-]/s', '', $exploded[3]);
$exploded[2] = trim($exploded[2]);
// end getting weather
// getting value passed by the arduino
$val = htmlspecialchars($_GET["num"]);
// end getting value
// reading file from storage
示例12: update_subjects
public function update_subjects()
{
$this->load->library("form_validation");
$this->load->helper("string");
if ($this->session->userdata("update-subjects")) {
$rules = array();
foreach ($this->session->userdata("update-classes") as $i) {
foreach ($this->session->userdata("update-subjects")[$i] as $j) {
$rules[] = array("field" => "credits[{$i}][{$j}]", "label" => "Credits for Class {$i} and Subject {$j}", "rules" => "required|decimal");
$rules[] = array("field" => "exams[{$i}][{$j}]", "label" => "Exams for Class {$i} and Subject {$j}", "rules" => "required|valid_exams");
}
}
$this->form_validation->set_rules($rules);
if ($this->form_validation->run()) {
$subjects = array();
foreach ($this->session->userdata("update-classes") as $i) {
foreach ($this->session->userdata("update-subjects")[$i] as $j) {
$subjects[$i][$j]["credits"] = $this->input->post("credits")[$i][$j];
}
}
$this->session->set_userdata("subjects-update-data", $subjects);
$exams = array();
foreach ($this->session->userdata("update-classes") as $i) {
foreach ($this->session->userdata("update-subjects")[$i] as $j) {
$exams[$i][$j] = multiexplode(array(',', ' '), $this->input->post("exams")[$i][$j]);
}
}
$this->session->set_userdata("update-exams", $exams);
$this->session->set_flashdata("success", true);
$this->session->set_flashdata("messages", "Your subjects have been updated successfully!");
redirect("grade/show_update_grades_form");
} else {
$this->session->set_flashdata("errors", true);
$this->session->set_flashdata("messages", validation_errors());
redirect("subject/show_update_subjects_form/{$id}");
}
} else {
$this->session->set_flashdata("errors", true);
$this->session->set_flashdata("messages", "You need to update classes first!");
redirect("classcontroller/show_update_classes_form");
}
}
示例13: check_action
$msj = check_action($service, $client, $action);
}
// Print Document Headers
doc_header($msj);
// Get service status
$service_status = get_service_status($service, $status_opts);
// Get playback status
$playback_status = get_playback_status();
print "<strong>now playing:</strong>";
print '<div style="width:50%;"><marquee behavior="scroll" direction="left"><pre>' . $playback_status . '</pre></marquee></div>';
print '<hr align="center" width="80%" noshade="noshade" />';
// Separate each instance
$delimiters = array("\n");
$result = multiexplode($delimiters, $service_status);
// Process each instance
foreach ($result as $pre_status) {
// Separate name and process status
$delimiters = array(" ");
$info = multiexplode($delimiters, $pre_status);
// Get usefull data
$replace = array("(", ")");
$name = str_replace($replace, " ", "{$info['0']}");
$status = $info[1];
// Print dynamic content
if ($name != "" && $status != "") {
$content = display_status($status, $name);
print $content;
}
}
// Print document footer
doc_footer();
示例14: update_classes
public function update_classes()
{
$this->load->library('form_validation');
$this->load->helper("string");
$this->load->model(array("subjectmodel", "grademodel"));
if ($this->session->userdata('update-classes')) {
$id = $this->session->userdata("branch-update-id");
$rules = array();
foreach ($this->session->userdata("update-classes") as $i) {
$rules[] = array("field" => "sections[{$i}]", "label" => "Sections for Class {$i}", "rules" => "required|valid_sections");
$rules[] = array("field" => "subjects[{$i}]", "label" => "Subjects for Class {$i}", "rules" => "required|valid_subjects");
$rules[] = array("field" => "terms[{$i}]", "label" => "Terms for Class {$i}", "rules" => "required|valid_terms");
$rules[] = array("field" => "grades[{$i}]", "label" => "Grades for Class {$i}", "rules" => "required|valid_grades");
}
$this->form_validation->set_rules($rules);
if ($this->form_validation->run()) {
$subjects = array();
$grades = array();
foreach ($this->session->userdata("update-classes") as $i) {
$subjects[$i] = multiexplode(array(',', ' '), $this->input->post("subjects")[$i]);
$grades[$i] = multiexplode(array(',', ' '), $this->input->post("grades")[$i]);
}
$this->session->set_userdata("update-subjects", $subjects);
$this->session->set_userdata("update-grades", $grades);
$classes = array();
foreach ($this->session->userdata("update-classes") as $i) {
$classes[$i] = array("sections" => multiexplode(array(' ', ','), $this->input->post("sections")[$i]), "terms" => multiexplode(array(' ', ','), $this->input->post("terms")[$i]));
}
$this->session->set_userdata("classes-update-data", $classes);
$this->session->set_flashdata('success', true);
$this->session->set_flashdata('messages', 'Classes have been updates successfully!');
redirect("subject/show_update_subjects_form");
} else {
$this->session->set_flashdata('errors', true);
$this->session->set_flashdata('messages', validation_errors());
redirect('classcontroller/show_update_classes_form');
}
} else {
$this->session->set_flashdata('errors', true);
$this->session->set_flashdata('messages', "You need update branch first!");
redirect('branch/show_update_branch_list');
}
}
示例15: file_get_contents
}
$i++;
}
$tab_mot[] = $mot;
$tab_occurence[] = 1;
}
// $RSSLink="http://feeds.gawker.com/deadspin/full";
$content = file_get_contents($RSSLink);
$x = new SimpleXmlElement($content);
$tab_mot = array();
$tab_occurence = array();
foreach ($x->channel->item as $entry) {
$html = str_get_html($entry->description . "");
foreach ($html->find('p[class=first-text]') as $p) {
$p_without_tags = strip_tags($p);
$words = multiexplode(array('"', ' ', '.', '|', ',', '?', '!', '—', '“'), $p_without_tags);
foreach ($words as $mot) {
if (strlen($mot) >= 5) {
occurence($mot, $tab_mot, $tab_occurence);
}
}
}
}
function permute(&$val1, &$val2)
{
$inter = $val1;
$val1 = $val2;
$val2 = $inter;
}
function sort_array(&$array1, &$array2)
{