I've read through a few questions about this here on s.o. and none seem to ask or answer the question very bluntly:
$ts_today = mktime( 0, 0, 0, date('m'), date('d'), date('Y') );
is this daylight saving aware?
if not, how do i make mktime() daylight saving aware?
...
I'm a little confused when I see the output of following code:
$x = "a";
$y = "b";
$x ^= $y;
$y ^= $x;
$x ^= $y;
echo $x; //got b
echo $y; //got a
And I wonder how does the operator ^ work here?Explanations with clarity would be greatly appreciated!
...
Hi,
I have an array:
$arr = array('foo', 'bar', 'bash', 'monkey', 'badger');
I want to have the elements in that array appear as the variables in my list():
list($foo, $bar, $bash, $monkey, $badger) = $data;
Without actually specifying the variables, I tried;
list(implode(",$", $arr)) = $data; and
list(extract($arr)) = $data;
B...
iam using GET command to get the content of a page.When i write the same command on shell prompt it gives correct result but when i use that in PHP file then sometimes its giving correct result but sometimes it gives only half of the content i.e. end-half portion only.
Iam using following command in shell script :-
GET http://www.abc.c...
Hi,
I am in a need of running the PHP parser for PHP code inside PHP. I am on Windows, and I have tried
system("C:\\Program Files (x86)\\PHP\\php.exe -l \"C:/Program Files (x86)/Apache/htdocs/a.php\"", $output);
var_dump($output);
without luck. The parameter -l should check for correct PHP syntax, and throw errors if some problems ex...
I have been helplessly trying to create a web service in PHP using NuSoap for the past 2 days. However, after endlessly sifting through various tutorials and guides, i am still stuck with 10 lines of code that refuse to work.
Server :
// Pull in the NuSOAP code
require_once('./lib/nusoap.php');
// Create the server instance
$server = ...
hey huys im counting my table with this code:
$county = mysql_query("SELECT COUNT(id) from table where type = 'application'");
$county = mysql_result($county, 0);
$applications = ''.$county.'';
this give me result like 1156563. but I want to see it like 1,156,563 with commas. how can i do this?
...
Hi,
Suppose I have this array:
$array = array('10', '20', '30.30', '40', '50');
Questions:
What is the fastest/easiest way to remove the first item from the above array?
What is the fastest/easiest way to remove the last item from the above array?
So the resulting array contains only these values:
'20'
'30.30'
'40'
...
I'm trying to to convert an existing PHP Regular Expression match case to apply to a slightly different style of document.
Here's the original style of the document:
**FOODS - TYPE A**
___________________________________
**PRODUCT**
1) Mi Pueblito Queso Fresco Authentic Mexican Style Fresh Cheese;
2) La Fe String Cheese
**CODE**
...
Hi, I have the below code and I am trying to get each "users post" into a seprate div, currently it shows all the posts in one div. Am sure its something simple I have just messed up on, this isn't finished yet so some parts in the code are still abit dodgy.
<?php
if (loggedin())
{
$ID = getID();
$query = "SELECT * FROM `posts`";
$res...
I'm a beginner PHP coder, recently I've been told I indent my code not correctly.
They say this is wrong:
if($something) {
do_something();
}
else {
something_more();
and_more();
}
While this is right?
if($something) {
do_something();
} else {
something_more();
...
I found this resource when looking to commonly format user's phone numbers.... http://www.eyesis.ca/projects/formatphone.html
I was wondering if someone else might have a better solution.
...
I'm creating something where users can upload an xml and data get's imported to the database.
Now I'm building some kind of a preview page where users will get to see how their input will look once it's stored.
What would be the fastest (in execution time), using XSL to transform the xml to a html page, or using php to render the outp...
I'm writing a php script to export MySQL database rows into a .txt file formatted for Adobe InDesign's internal markup.
Exports work, but when I encounter special characters like é or umlauts, I get weird symbols (eg Chloë Hanslip instead of Chloë Hanslip). Rather than run a search and replace for every possible weird character, I need...
hi
does anyone know any sort of app that lets users visit a page on their mobile phone, enter information and have it update the website
i believe the term is "mobile-blogging" but there isn't all that much on google
or, is there any good resources for coding pages specifically for a mobile phone? I could probably design a script to i...
I have quite a few libraries and models that get loaded into a controller, and each library/model creates an instance of CI using $this->CI =& get_instance(); in the __construct function.
Are there any performance issues with this and is there a better way?
...
One from here:
$sth->execute(array(':calories' => $calories, ':colour' => $colour));
The other from here:
/*** reassign the variables again ***/
$data = array('animal_id'=>4, 'animal_name' => 'bruce');
/*** execute the prepared statement ***/
$stmt->execute($data);
My question is: :key or key ?
Sorry I don't have the PHP environm...
Hi, I'm trying to use JQuery's autocomplete plug-in but for some reasons Internet Explorer is not compatible with the other browsers:
When there is an accent in the "autocompleted" string it passes it with another encoding.
IP - - [20/Apr/2010:15:53:17 +0200] "GET /page.php?var=M\xe9tropole HTTP/1.1" 200 13024 "http://site.com/page.php"...
hi.i have two problems with jquery $.ajax.
first problem is ihave a php file named action.php and here the code:
if($_GET['action']=='add'){
//rest of the code here
}
And i use jquery $.Ajax function to call that when form fills:
$.ajax({type:"POST", url:"action.php?action=add", data:$("#form").serialize(), cache:false, timeout:1...
Hi Guys,
I have tried lots of ways to get the last inserted ID with the code below (snipplet from larger class) and now I have given up.
Does anyone know howto get PDO lastInsertId to work?
Thanks in advance.
$sql = "INSERT INTO auth (surname, forename, email, mobile, mobilepin, actlink, regdate) VALUES (:surname, :forename, :ema...