php

How to validate a domain name using Regex & Php?

Hi, I want a solution to validate only domain names not full urls, The following example is what i'm looking for: domain.com -> true domain.net/org/biz... -> true domain.co.uk -> true sub.domain.com -> true domain.com/folder -> false domµ*$ain.com -> false Thank you ...

Sorting an array in PHP based on different values

I have an array whose elements are name, reversed_name, first_initial and second_initial. A typical row is "Aaron Smith", "Smith, Aaron", "a", "s". Each row in the array has a first_initial or second_initial value of "a". I need to display the rows alphabetically but based on the "a" part, so that either the name or reversed_name will b...

PHP on the Google App Engine

How can i run a PHP script on the Google App Engine? I know that Java and Python are supported. Is PHP possible? ...

Understanding how to inject object dependencies

I have an object that loads an instance of another object in a method. $survey = new survey; $question = new question($survey); $question->load($question_id); class question { public function __construct(&$survey) { $this->survey = $survey; } public function load ($id) { // now a question is loaded // want t...

How to get file content-type with PHP < 5.3?

How do I retrieve the content-type of a file using PHP? I don't want to rely on the file extension alone. Thanks! ...

how to insert a verify code HTML Standard Paypal

i have a product , product infor was save in table , and have a field verify_code, i will create a string by md5 and insert to this field, and i want send this verify_code to paypal then i can check response return from paypal if verify_code == response verify_code will do next action how i can do it with html standard paypal? ...

Lightweight PHP server to bundle with application?

Does there exist some sort of PHP server that can be bundled with a locally-deployed application? It sounds wonky, but the end result is I can't use a remote web server to do anything. Clients will be downloading a package, and the plan is to use a Java backend that reads from a flat file. The flat file contains settings and is modified ...

Same-directory includes failing on a Fedora server with PHP.

I have a couple files that look like this: index.php: <?php include('includes/header.php'); ... includes/header.php: <?php include('config.php'); ... The error I get is Warning: require(config.php) [function.require]: failed to open stream: No such file or directory in [dir]/includes/header.php on line 2 Fatal error: re...

php nl2br limit x amount

Hi this is fairly simple I want to know how to use nl2br(); in php, but limit the amount of consecutive <br/>'s that are allowed at one time. //For Example: A user enters 1st line 2 line breaks 3 line breaks 6 line breaks 2 line breaks Is there anyway to have php limit the <br/>'s to no more than x amount of numbers at ...

Simulate Form Post in PHP

I have an HTML form (form action="https:..." method="post"). I want to handle the post in PHP. How do I simulate the form post in PHP? So, instead, I will have (form action="helper.php") a and helper.php will post the form data. ...

Symfony plugin development

Can anyone point me towards a good tutorial/documentation on writing symfony plugins? I'm trying to write a plugin for paypal using doctrine and sf 1.4. Thanks ...

Declaring variable as PHP class

I have a variable called $theclass and it's a string "Home_class". How can I define a class out of that string? The reason I need to do this is that the variable will change and I want to be able to declare the class that the variable is equal to. Is this possible? Thanks for any help. ...

How do I access a php variable from JavaScript?

How do I call php variables or queries in JavaScript? ...

How to use unset() for this Linear Linked List in PHP

I'm writing a simple linear linked list implementation in PHP. This is basically just for practice... part of a Project Euler problem. I'm not sure if I should be using unset() to help in garbage collection in order to avoid memory leaks. Should I include an unset() for head and temp in the destructor of LLL? I understand that I'll use...

Browsed Time Problem.

I want to display the browsed time of a user, But when i refresh it, it will be again start from 0:0:0. How can it handle? <?php $total_mints=($live_match['match_name']) * (60); ?> <script language="javascript"> display_c(<?=$total_mints?>,'ct'); </script> <script type="text/javascript"> function display_c(start,div){ window.start ...

facebook application error

it needs facebook facepile plugin(http://developers.facebook.com/docs/reference/plugins/facepile). i tried but i am getting this error (The Facebook Connect cross-domain receiver URL (http://static.ak.fbcdn.net/connect/xd_proxy.php#?=&amp;cb=f223d517566e616&amp;origin=http%3A%2F%2Fpromolife.com.au%2Ff3e13728ba8ec8&amp;relation=parent.p...

PHP automaticly parses my string?

Some Background info: My web application stores some XML in a Text column of the MySQL database. This XML represents a transaction for the application. The problem occurs when I'm testing my library. Within PHP, I have a string: $s="<flist><transaction amount=\"10\" type=\"income\">Initial Amount</transaction></flist>"; However, wh...

How can use foreach to Loop Through PHP Array

How can use foreach loop to loop through the $Result? <?php mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error()); mysql_select_db("mydb"); $Query = mysql_query("SELECT * FROM mytable"); $Result = array( ); while ($Row = mysql_fetch_array ( $Query) ) { $Result [ ] = $Row; } m...

PHP regular expression for positive number with 0 or 2 decimal places

Hi I am trying to use the following regular expression to check whether a string is a positive number with either zero decimal places, or 2: ^\d+(\.(\d{2}))?$ When I try to match this using preg_match, I get the error: Warning: preg_match(): No ending delimiter '^' found in /Library/WebServer/Documents/lib/forms.php on line 862 ...

How to send email after one hour of the joining in getresponse.com

HI all, I have an account in getresponse.com I want to send emails to the members in my mailing list after one hour of their joining. Please tell me how can i do this ...