<?php
class Node {
public $value;
public $next = null; // next node
public $prev = null; // previous node
public function __construct($value) {
$this->value = $value;
}
}
class Palindrome {
/**
•@param string $word
•@return bool */
public static function isPalindrome($head, $tail){
if ($head == null)
return true;
while ($head != $tail){
if ($head->value != $tail->value)
return false;
$head = $head->next;
$tail = $tail->prev;
}
return true;
}
}
$head = new Node(1);
$firstNode = new Node(2);
$secondNode = new Node(3);
$tail = new Node(4);
$head->next = $firstNode;
$firstNode->prev = $head;
$firstNode->next = $secondNode;
$secondNode->prev = $firstNode;
$secondNode->next = $tail;
echo Palindrome::isPalindrome($head, $tail);
PHP mail function and mail configuration in XAMPP and sending mail is done from sendmail through localhost. I hope it will help you. mail() function <? php $to = 'dubeynitish22@hotmail.com' ; $subject = 'Test' ; $message = 'Hello' ; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion (); if (! mail ( $to , $subject , $message , $headers )){ echo "Error !!" ; } else { echo "Email Sent !!" ; } ?> 2. php.ini configuration (For SEND-MAIL) [ mail function ] ; For Win32 only . ; http : //php.net/smtp ; SMTP = localhost ; http : //php.net/smtp-port ; smtp_port = 25 ; For Win32 only . ; http : //php.net/sendmail-from ; sendmail_from = me@example . com ; For Unix only . You may supply arguments as well ( default : "sendmail -t -i...
Comments
Post a Comment