Is there anyway to find the date difference in php? I have the input of from date 2003-10-17 and todate 2004-03-24. I need the results how many days is there within these two days. Say if 224 days, i need the output in days only.
I find the solution through mysql but i need in php. Anyone help me, Thanks in advance.
This is confusing as hell, here's the php I'm using:
<?php echo date('H:i D j, F',$j->date); ?>
This is what it gives me:
01:33 Thu 1, January
Which seems fine, until you look at the actual time that is being given ($j-date provides):
2010-06-12 21:12:23
Why is it giving me a January and what am I doing wrong?
Hi,
We were given an assignment to develop a prototype for a customer community. It was suggested PHP as the programming language. (but we're not supposed to actually code it, just a prototype with documentation is required)
I'm wondering what are the best practices/ tools used in Unit testing, Integration Testing and System testing for such a php app
Thanks
Hi i would like to filter array in php. for example
$a = ARRAY('a', 'b', 'c', 'd', 'e');
$b = ARRAY('c', 'd');
$a will be filtered by values in array $b
and result is ['a', 'b', 'e']
may I know how to do it in php?
Thank you.
I am a php beginner and seed on the forum such a php expression:
$regex = <<<'END'
/
( [\x00-\x7F] # single-byte sequences 0xxxxxxx
| [\xC0-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
| [\xE0-\xEF][\x80-\xBF]{2} # triple-byte sequences 1110xxxx 10xxxxxx * 2
| [\xF0-\xF7][\x80-\xBF]{3} # quadruple-byte sequence 11110xxx 10xxxxxx * 3
)
| ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111
| ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111
/x
END;
is this code correct? what should mean some strange (4 me) constructions like <<< 'END' / /x and END;
thanks
Hi
I want to write a php script which updates svn working directory
I tried with below code , but it does not work.I guess because the USER for php script is "apache" but for svn update it needs to be "homeuser"
putenv("USERNAME=homeuser");
putenv("HOME=/home/homeuser");
exec("svn update /home/homeuser/path/to/working/dir", $info); //svn update with full path
print_r($info);
how to get around ?
I want to have users store the url in my database I'm using php mysql and htmlpurifier I was wondering if the following code was good way to filter out bad data?
Here is the Partial PHP code.
$url = mysqli_real_escape_string($mysqli, $purifier->purify(htmlspecialchars(strip_tags($_POST['url'])));
Hello,
Is it possible to "deny from all" apache htaccess style using php.
I can't use htaccess because im using different webserver, so i wan't to use php to workaround it.
So let say user are trying to access folder name 'david', all content and subdirectory are denied from viewing.
Warning: sprintf() [function.sprintf]: Too few arguments in /home/inrunitc/public_html/chek/chek.php on line 132
Query was empty
I am new to PHP and mysql and I have like 88 fields in my form - what should I do ?
I tried to follow PHP.net curl site and even this link: http://curl.phptrack.com/forum/viewtopic.php?t=52
and try to install the CURL in my window laptop. It doesn't work.. CURL is not installed.
I wonder do I need to run it on windows server...
Anyone has good sites guiding me how to install CURL? thanks.
Hi,
I am developing online video streaming website on PHP.
I need two functionalities:
Need to add title/text at bottom of the video dynamically.
Need to add background music to video dynamically.
Is it possible with PHP or any available open source library?
Can anyone guide me or provide links to this type of library ?
Thanks.
I have a local server which needs to make changes to a virtual hosts apache config file and then restart apache so the new config takes effect.
Can PHP do this? I tried passthru and exec but they didn't work. Maybe the problem is that I'm trying to restart PHP's parent process?
Thanks for any help!!
PHP beginner's question.
I need to keep image paths as following in the database for the admin backend.
../../../../assets/images/subfolder/myimage.jpg
However I need image paths as follows for the front-end.
assets/images/subfolder/myimage.jpg
What is the best way to change this by PHP?
I thought about substr(), but I am wondering if there is better ways.
Thanks in advance.
Getting the following error when trying to start a session:
Warning: session_start() [function.session-start]: Node no longer exists in file.php on line 3
The script uses SimpleXML to parse XML files from remote hosts. It's running on a Linux Ubuntu server with PHP 5.2.6.
Has anyone come across this message before or have an insight in to what it means?
Hello, did you know a php script (a class will be nice) who get the url of the first image result of a google api image search? Thanks
Example.
<?php echo(geturl("searchterm")) ?>
Hello, I've recently started learning PHP, but I have a wide knowledge on C++. I've been wondering how to make a web bot and now, I would greatly like to make one. I won't be using this robot for spamming or anything, just as a test of what PHP/C++ can do online. I was wondering how I could go about doing this and if you have any articles/tutorials that would be helpful.
Thanks,
John
i have a submit page in html. when i submit the form data, it goes to a php page, which inserts the data in the database.
my question is how would i ensure that the data on the html page is not null or empty without using javascript? is there anyway this could be done in php? thanks!
I ask this question because i learned that in programming and designing, you must have a good reason for decisions. I am php learner and i am at a crossroad here, i am using simple incrementation to try to get what im askin across. I am certainly not here to start a debate about the pros/cons of pointers but when it comes to php, which is the better programming practice:
function increment(&$param) {
$param++;
}
Or
function increment($param){
return $param++;
}
$param = increment($param);
Hi everyone...
All are aware of the rename function in php ....
But is there a way to just change the name of a folder using php...? Or copying the whole folder to a new place with the intended name is the only way..?
Thanks for your answers...
What is the best way to implement web services in PHP? I have heard about libraries like NuSOAP and WSO2 web service platform, But don't know what is the best ( or a good and easy to learn) for using web service in PHP?
Hi guys,
I am trying to write an php twitter script which will be run by crontab, what the script does is to get the tweets from a dedicated twitter account.
I have looked at some of the php twitter oauth libraries, all of them seem to use redirect to a twitter page to get a token, then goes back to a callback link. In my case I don't want to have any user interaction at all.
Could anyone please tell me what I should do?
Regards
James
I'm interested in literature (articles on internet, in magazines, books, podcasts - I don't really mind anything) that describes how PHP works internally, about its gotchas and perhaps some advanced functions. Is there anything like this out there? I tried to search on Google, but majority of articles were about starting with PHP and its basic functions.
Any input is really welcome as I'm trying to understand the language internally - I'm tired of my mindless typing of code without understanding its essence.
Hello,
It seems that I need to somehow disable IPv6 on my php pages, but I am not sure how to do this. I think I have to add --disable-ipv6 somewhere into my INI file... this doesnt look like proper syntax though.
I am trying to solve the following bug:
http://bugs.php.net/45519
Does anyone know where to put this?