I want create arrays with object keys in PHP, i.e. something like this:
<?php
$keyObject = new KeyObject;
$valueObject = new ValueObject;
$hash = array($keyObject => $valueObject);
However, this raises an error. Arrays may only have integer or string keys. I end up having to do something like:
$hash = array(
'key' => $keyO...
how to get the date of first monday of the current year using php functions
example 04-01-2010
...
Has anyone see this "iif" in php before? What is that actually? I try to search the documentation for it in php.net but I cant found any. Anyone can give a simple example of how to use this "iif"?
...
I am using the Propel ORM with SF (1.4). I am writing a class, and I need to rewrite a query Doctrine query into Propel:
$q = Doctrine_Core::getTable('sfGuardRememberKey')->createQuery('r')
->innerJoin('r.sfGuardUser u')
->where('r.remember_key = ?', $cookie);
if ($q->count()){ // Do Something }
can anyone help wi...
I have to transfer a big array from one server to another using a file. It's a multidimensional, but quite simple array. Now I'm searching for the most efficient way, to get this file into my application on the second server. So this question is about the file->array part, not the array->file part on the first server.
Of course I did so...
When building dynamic websites I use a php include to make my connections to the database. The included file is very basic:
mysql_connect($hostname = 'host', $username = 'user', $password = 'password');
mysql_select_db('database');
This works fine.
In some places I use an AJAX system to create drag-and-drop reordering of databa...
I was reading http://github.github.com/github-flavored-markdown/
I would like to implement that "Newline modification" in PHP Markdown:
Best I could think of is:
$my_html = Markdown($my_text);
$my_html = preg_replace("/\n{1}/", "<br/>", $my_html);
But this runs very unexpectable.
...
Hi,
I need some help with this problem, please.
For days I have been trying now.
The retrieving off feeds and parsing them is not really a problem, but
Uploading data in the form off xml is?
The code below is partially from the google docs samplecode also, but obviously it's not working.
I hope someone else is more into the google ap...
I would like to parse boolean expressions in PHP. As in:
A and B or C and (D or F or not G)
The terms can be considered simple identifiers. They will have a little structure, but the parser doesn't need to worry about that. It should just recognize the keywords and or not ( ). Everything else is a term.
I remember we wrote simple ari...
Hi,
I have a PHP Object with an attribute having a dollar ($) sign in it.
How do I access the content of this attribute ?
Example :
echo $object->variable; // Ok
echo $object->variable$WithDollar; // Syntax error :-(
...
I am new to databases. I have a classifieds website with MySQL db and I am soon about to use SOLR to index them also. Then whenever a query is done, SOLR will return ID:s and I will match those ID:s to the MySQL database and fetch the ads to display.
Anyways, I have trouble making the db.
Users may choose from a drop-list what category...
Hi there
I'm developing a web-application with PHP and some libraries. The problem is that i need to generate some excel files, and this procedure takes a lot of time. Can you help me with some tools to identify where my application spends a lot of time,. Can you recommend a php tool which will help me to detect the bottle necks?
ps: t...
Is there an implementation of Lex and Yacc in PHP?
If not, can anyone suggest a lexical analyser and parser generator (ie, anything like Lex and Yacc) that will create PHP code. I'm not too worried about the performance of the resulting parser.
I am sick of using regex to parse things that really shouldn't be parsed with regex...
...
I want to build a json_encoded list of all restaurants nearby a point using PHP
looking to build a php function which takes Parameters: Latitude,longitude,radius (in meters). And return a json_encoded list
I have a API key and I work with js but I wat it done with server-side scripting php
dose any one know how to do it.
I want to...
Hi
I require a class which will generate barcode image files, preferably compatible with the most common standards.
I'm looking for recommendations / suggestions based on personal experiences with such things.
Many Thanks
...
i have an array like this
Array
(
[0] => "<[email protected]>"
[1] => "<[email protected]>"
[2]=> "<[email protected]>"
)
now i want to remove "<" and ">" from above array so that it look like
Array
(
[0] => [email protected]
[1] => [email protected]
[2] => [email protected]
)
how to do this in php? please help me out
I'm ...
Here is the code that I'm working on:
login.php:
<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("koro",$con);
$result= "SELECT * FROM users WHERE
UNAME='".mysql_real_escape_string($_POST['Uneym'])."'";
echo $result;
...
I have a set of rather static pages wich I moved to the views/pages folder. The resulting *.ctp files are editable by my customer through CushyCMS (simplistic cms perfect for dummy proof editing). However CushyCMS generated preview links that obviously don't take CakePHP into account. I would like to solve this little problem with custom...
i need to test if any of the strings 'hello', 'i am', 'dumb' exist in the longer string called $ohreally, if even one of them exists my test is over, and i have the knowledge that neither of the others will occur if one of them has.
Under these conditions I am asking for your help on the most efficient way to write this search,
strpos(...
I have a problem with the session_id(). When I call the session_destroy(), by going specifically to the logout page and then I go back to my start page the session_id is still the same. What to do?
But when I close the browser window the session_id is a new one, but what if a person not closes his/her browser window?
...