从向量数组中删除特定值

时间:2019-09-19 10:25:52

标签: c++ vector

<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
$cname = $_POST['cname'];


$email_from = 'myemail@protonmail.com';

$email_subject = "New Form Submission";

$email_body = "User Name: $name.\n".
"User Company Name: $cname.\n".
"User Email: $visitor_email.\n".
"User Message: $message.\n";


$to = "info@matinint.com";

$headers = "From: $email_from \r\n";

$headers .= "Reply To: $visitor_email \r\n";

mail($to,$email_subject,$email_body,$headers);

header("Location: index.html");

?>

这段代码从向量中删除了所有正好为4的值,但是我只想删除第一个为4的值,之后的其余4个都不删除,如果向量中根本不存在4不删除任何。如何做到这一点?请帮助我。我还需要最小的时间复杂度。

0 个答案:

没有答案