php5

Which is faster for PHP5 to deal with/easier to work with in PHP; XML or JSON, and file_get_contents or cURL?

Is there any reason why I should pick JSON over XML, or vice-versa if both are available? Tips for optimizing performance when dealing with data feeds are also appreciated! ...

How do I dynamically invoke a class method in PHP?

How can I dynamically invoke a class method in PHP? The class method is not static. It appears that call_user_func(...) only works with static functions? Thanks. ...

Trackbacks in PHP

I'm writing a custom blog engine and would like to have trackbacks similar to Wordpress. I could look at the Wordpress source, but I'd really prefer a tutorial of some sort and so far I haven't been able to find one. Are there any good tutorials for implementing trackbacks or pingbacks in PHP5? ...

TinyMCE Draws Okay, But Won't Let Me Type In It. In FF, Buttons Have Error: Component returned failure code: 0x80004005

In previous applications, I was able to get TinyMCE to work just fine. But in this web app, I get the rich editor to show up okay, but for some reason I cannot type into the rich editor field and when I click a button like for bolding, I get this error: Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)...

How to decode base64 (in little endian) with PHP?

How can I decode a base64 encoded message in PHP? I know how to use PHP_base64_decode function, but I wanna know how to write little endian part, like the code below, it is base64 code with little endian: (how to write little endian part in php) Original Base64 Content ( as posted by original poster ) : http://stackoverflow.com/revisio...

What php sites would you recommend following?

Which php sites would you recommend following for php news, new open source projects, some that have been around for a while, etc. Just looking to stay on top of the php industry and also find new tricks and what not to make my programming life easier :) G-Man ...

Should I extend this class or just use it?

I am writing helper classes for a large project in PHP and I have written a class called Command. It is essentially an OOP wrapper around running system commands from PHP in a controlled way. It has methods like addOption() to add -a type options and addArgument() to add other arguments. I will need to do a lot of scp'ing of files aro...

many-to-many lookup

I am making a waitlist application. I'd like to be able to send applications a unique confirmation code - and later on be able to find a user either by confirmation code or by username. Will Symfony be able to call Models to say either: Code->findUser($code_string); User->getCode(); I believe that the below schema has the relationshi...

Mutability and Reference of PHP5 GET Variables

I have the following in a page e.g. /mypage?myvar=oldvalue $_SESSION['myvar'] = $_GET['myvar']; $myvar = 'a_new_string' Now $_SESSION['myvar'] has the value 'a_new_string' Is this by design? How can I copy the value of 'myvar' rather than a reference to it? ...

POST data to a PHP page from C# WinForm

I have a winForms NET3.5SP1 app, and want to POST data to a PHP page. I'm also going to be passing it as JSON, but wanted to get straight POST working first. Here is the code: Person p = new Person(); p.firstName = "Bill"; p.lastName = "Gates"; p.email = "[email protected]"; p.deviceUUID = "abcdefghijklmnopqrstuvwxy...

Zend Framework Updates?

How long do you normally test an update for Zend Framework before pushing it out into a productions project. We can break this question up into minor updates 1.6.0 -> 1.6.1 or maybe a major update 1.6.2 -> 1.7.0. Obviously you don't release it if it add bugs to your code. Also, as with most other server software updates normally peopl...

What PHP-specific questions would you ask in a job interview?

We're having a PHP freelancer come by next week, and are assuming he knows his way around PHP. But of course, we would like to make sure. What questions would you ask a candidate in a PHP job interview? Would you have them write some sort of bubblesort op paper, without the aid of a computer? Would you ask array-specific questions, OOP ...

Short unique id in php

I want to create a unique id but uniqid() is giving something like '492607b0ee414'. What i would like is something similar to what tinyurl gives: '64k8ra'. The shorter, the better. The only requirements are that it should not have an obvious order and that it should look prettier than a seemingly random sequence of numbers. Letters are p...

Can you hint return types in PHP 5.2.5?

I think my eclipse's ctrl+clicking links might benefit greatly... Edit: I'm using eclipse PDT. Edit 2: I'm very happy with the solution of putting docblocks before functions (and variables) with an @return or @var statement, I've just updated the documentation of my app and now eclipse is showing me what functions are available to what...

PHP Object ID

Hi, I'm using PHP 5.2. I'd like to find a way to output a unique id for every object, so it's easy when looking over logs to see which objects are the same. In Ruby, I'd just say object.object_id to get Ruby's internal identifier for the object. There doesn't seem to be an obvious way to do this in PHP. Is there is a built-in way of d...

inheritance from two parent classes

Hi, I read about this ages ago but never tried it now I can't remember if this is possible or not. Is it possible to extend a class from two parents on php5 e.g. class_d extends class_c and class_b moreover can you do this if class_c and class_b are themselves extended from class_a ... so you get something like this ...

PHP objects as faux-arrays

I have an object that implements ArrayAccess, Iterator and Countable. That produces a nigh-perfect array masking. I can access it with offsets ($object[foo]), I can throw it into a foreach-loop, and many other things. But what I can't do is give it to the native array iterator functions (next(), reset(), current(), key()), even though I...

Zebra Striping with PHPTAL?

I'm trying out PHPTAL and I want to render a table with zebra stripes. I'm looping through a simple php assoc array ($_SERVER). Note that I don't want to use jQuery or anything like that, I'm trying to learn PHPTAL usage! Currently I have it working like this (too verbose for my liking): <tr tal:repeat="item server"> <td tal:conditi...

How do you find a description of the DateTime class in the PHP documentation?

Sounds easy, but I can't find where this built in class and others exists in the documentation. I use functions but want to know what there is on the OO side. ...

phpmyadmin - save file to disk

when i point my browser to http://localhost/phpmyadmin, instead of showing me its front page, it comes up with save as dialog. I'm running: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch13 Server I've reinstalled both apache2 and php5. After re-install i don't have httpd.conf file, how can i get it back? Is there a standard file which i can ju...