Is it possible to chain static methods together using a static class? Say I wanted to do something like this:
$value = TestClass::toValue(5)::add(3)::subtract(2)::add(8)::result();
. . . and obviously I would want $value to be assigned the number 14. Is this possible?
Update: It doesn't work (you can't return "self" - it's not an ins...
This is an issue I've run into with a website I'm designing. I'm using a template based design for the site, so the information on the page is thrown inside the template when the page is accessed. The information shown changes based on the page attribute passed in as a GET request.
So, to actually load the information into the body area...
So I'm writing a framework on which I want to base a few apps that I'm working on (the framework is there so I have an environment to work with, and a system that will let me, for example, use a single sign-on)
I want to make this framework, and the apps it has use a Resource Oriented Architecture.
Now, I want to create a URL routing c...
Has anyone any reources for learning how to implement SVG with php/mysql (and possibly with php-gtk)? I am thinking of making a top-down garden designer, with drag and drop predefined elements (such as trees/bushes) and definable areas of planting (circles/squares). Gardeners could then track over time how well planting did in a certain ...
Specifically I have a PHP command-line script that at a certain point requires input from the user. I would like to be able to execute an external editor (such as vi), and wait for the editor to finish execution before resuming the script.
My basic idea was to use a temporary file to do the editing in, and to retrieve the contents of th...
In PHP, what is the best practice for laying out the responsibilities of a Db Abstraction Layer?
Is OOP a good idea in terms of performance? How much should be generic object code, and how much should be very specific functions?
...
I am running following PHP code to interact with a MS Access database.
$odbc_con = new COM("ADODB.Connection");
$constr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_path . ";";
$odbc_con -> open($constr);
$rs_select = $odbc_con -> execute ("SELECT * FROM Main");
Using ($rs_select -> RecordCount) gives -1 though the query ...
In ASPNET, I grew to love the Application and Cache stores. They're awesome. For the uninitiated, you can just throw your data-logic objects into them, and hey-presto, you only need query the database once for a bit of data.
By far one of the best ASPNET features, IMO.
I've since ditched Windows for Linux, and therefore PHP, Python an...
Hi @ll.
Today I stumbled about a Problem which seems to be a bug in the Zend-Framework. Given the following route:
<test>
<route>citytest/:city</route>
<defaults>
<controller>result</controller>
<action>test</action>
</defaults>
<reqs>
<city>.+</city>
</reqs>
</test>
and three Urls:
mysite.local/c...
Having read in lots of places that PHP is looked down upon by lots of people, I'm thinking that I should learn a "good" language for web development to add to my repertoire.
What would be a good thing to learn? Ideally I want something that will teach me good programming habits as well as having a strong community and online manual, I'm...
Hi,
I need to be able to change the users' password through a web page (in a controlled environment).
So, for that, I'm using this code:
<?php
$output = shell_exec("sudo -u dummy passwd testUser testUserPassword");
$output2 = shell_exec("dummyPassword");
echo $output;
echo $output2;
echo "done";
?>
My problem is that this script is n...
We have a couple of developers asking for 'allow_url_fopen' to be enabled on our server. What's the norm these days and if libcurl is enabled is there really any good reason to allow?
Environment is: Windows 2003, PHP 5.2.6, FastCGI
Thanks
Kev
...
Is there a way to prevent someone from faking a mime type on a file upload and then running a php/exe/etc...
I have to make the file upload directory writeable and executable so that the files can be stored, but this allows anyone to run a script after. One thing I can do is add random data to the file name so they can't guess the file...
$a = '{ "tag": "<b></b>" }';
echo json_encode( json_decode($a) );
This outputs:
{"tag":"<b><\/b>"}
when you would think it would output exactly the input. For some reason json_encode adds an extra slash.
...
Have you managed to get Aptana Studio debugging to work? I tried following this, but I don't see "Windows -> Preferences -> Aptana -> Editors -> PHP -> PHP Interpreters" in my menu (I have PHP plugin installed) and any attempt to set up the servers menu gives me "socket error" when I try to debug. Xdebug is installed, confirmed through p...
I'm looking for PHP Optimization tips. Coding practices and other methodologies which will make my PHP execute faster. One tip per answer, please, and include why it makes the code faster!
This is not about HTML or Javascript execution, but purely server side PHP execution.
...
In a CakePHP 1.2 app, I'm using
flash();?>
to output messages like "Record edited". It's working great.
However, I want to add a link called "Dismiss" that will fade out the message. I know how to construct the link, but I don't know how to insert into the output of the flass message.
The flash message wraps itself in a DIV tag. I wan...
I'm calling a webservice using the NuSoap PHP library. The webservice appears to use .NET; every time I call it I get an error about using an invalid SoapAction header. The header being sent is an empty string. How can I find the SoapAction that the server is expecting?
...
I decided to install APC to speed up the site that I work for. Sadly, I found out that it was already installed and enabled(The developer who first worked on the servers has moved on).
Then I decided to check the usage of it to see if it needs more memory allocated to it or not. This is when I discovered something weird. A simple file w...
I'm writing an RSS to JSON parser and as a part of that, I need to use htmlentities() on any tag found inside the description tag. Currently, I'm trying to use preg_replace(), but I'm struggling a little with it. My current (non-working) code looks like:
$pattern[0] = "/\<description\>(.*?)\<\/description\>/is";
$replace[0] = '<descript...