Why is it not possible to do something equivalent to this in PHP:
(Array(0))[0];
This is just for sake of argument, but it seems strange it does not allow access of anonymous objects. I would have to do something like the following:
$array = Array(0);
$array[0];
Any ideas why this is the behavior of PHP?
...
Can someone please explain "re-usable structures" for me?
I was working on making some db objects in php, but was told I was using too much processing from the computer cause I made stuff to complicated with the below objects:
My DB objects:
$db = new Database;
$db->db_connect();
$post_content = new DbSelect;
$post_content->select('id...
I am currently developing a system on a server running PHP version 5.1.6 thus I am forced to use Symfony 1.1 in the current environment.
I am planning to migrate the application from 1.1 to 1.2 in the somewhat near future and I was wondering if anyone has any experience with this?
I have attempted to migrate a system from 1.0 to 1.1 and ...
anyone know a good tutorial of how to make the status bar found in the new facebook? the one on the bottom. looks really cool
i was thinking it was written in either ajax or jquery. but not sure.
...
I want to browse all folders on my computer without using opendir(), in PHP.
...
Hi,
I have tried to use ZendSession class with AMFPHP, but AMFPHP uses raw PHP sessions in some of its functions and methods. I strongly need to manage all session variables by ZendSession. Is there any smart method to get it, instead of hack and modify original AMFPHP code?
...
I have successfully created a simple RSS feed, but entries keep coming back as unread and updated, and entries deleted from the client reappear everytime I ask mail to update the feed.
What am I doing wrong?
I use this simple function to create an rss feed:
public static function getFeed($db)
{
$title = 'Latest feeds';
$feedU...
I am creating a rss feed file for my application in which I want to remove HTML tags, which is done by strip_tags But strip_tags is not removing html special code chars
& © etc
Please tell me any function using which I can remove these special code chars from my string,
Thanks
...
I seem to be confused about PHP output buffering. I have code like this:
function return_json($obj) {
ob_get_clean();
ob_start();
header("Content-Type: application/json");
echo json_encode($obj);
exit;
}
But it doesn't seem to like the ob_get_clean(). I do that because some HTML might accidentally get generated before it ge...
Do you have a strategy for this? If I sell a web-system to a client and in accordance with the legal agreement, the customer is not allowed to sell it to others, how can I be sure he doesn't do that anyway?
My first idea is some sort of key that must be in the root directory, and that file is only valid for that specific domain.
Other ...
Well, I just got Delphi for PHP because we code our app in Delphi and I'm the web guy. Go figure, it looks pretty cool and super easy, but I can't imagine making an entire website with absolute positioned labels, that would be kind of obscene, cross-browser compliant, but obscene.
Can anyone suggest good resources/usergroups/tutorial...
I'm trying to narrow down some weirdness going on with my AJAX calls. My PHP scripts have this at the start:
ob_start("ob_gzhandler");
Works great with HTML. But are there any problems with doing it with application/json data? Any browser issues anyone is aware of?
...
In my template.php file I've this:
function myadmintheme_theme(&$existing, $type, $theme, $path) {
return array(
'node_form' => array(
'arguments' => array('form' => NULL),
'template' => 'ccktype',
),
);
}
And I've a ccktype.tpl.php in the same dir:
<b>works!</b>
But is not working, if I enter to node/add/cckt...
I want to run a function that has 2 different outcomes, but I want each outcome to be truly 50%. I am assuming rand(0,1) is the way to go, but I am curious if that could possibly favor one over the other. What is the best way to get a 50/50 outcome?
Thanks.
EDIT:
thanks guys I don't want it to be random though, I want the outcome to be...
Suppose I have a User class with 'name' and 'password' properties, and a 'save' method. When serializing an object of this class to JSON via json_encode, the method is properly skipped and I end up with something like {'name': 'testName', 'password': 'testPassword'}.
However, when deserializing via json_decode, I end up with a StdClass...
I need to generate sequences of games using the round robin algorithm. I have the php page where the user can input the tournament name which will be inserted into the database and it has got a drop down menu up to 32 teams (select number of teams).
So if I select 4 teams in the page, so it will be from team 1 to team 4 which would be ...
As you may or may not know, you can generate a color syntax-higlighted HTML file from a PHP source file using php -s.
I know about the syntaxhighlighter that Stackoverflow uses and that's not really what I'm looking for. I'm looking for something will generate HTML output without Javascript.
Does anyone know of something equivalent to...
Hardest problem to explain:
$lol = "hello";
$that = "* music
* books
* games
* asos
* cry";
$lol = str_replace("*", $line, $that);
$name = str_replace(" ", "-", $line);
$myFile = "output/$name.csv";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $lol;
fwrite($fh, $stringData);
fclose($fh);
I'm running through a ...
When using Zend_Filter_Input, are Filters or Validators processed first?
...
I need to remove all characters from a string which aren't a-z A-Z 0-9 or " ", anyone got a function to do this?
...