php5

Did anyone try out DDD with a php application?

Are there any open source php applications that use DDD philosophy? DDD = Domain Driven Design ...

Parsing Media RSS using XMLReader

<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"&gt; <channel> <title>Title of RSS feed</title> <link>http://www.google.com&lt;/link&gt; <description>Details about the feed</description> <pubDate>Mon, 24 Nov 08 21:44:21 -0500</pubDate> <language>en</language> <it...

Should PHP 'Notices' be reported and fixed?

I recently switched to a new setup that is reporting PHP Notices; my code has worked fine without these notices being fixed, but I am wondering if it makes sense to fix every one and leave them reported or just ignore them and turn notice reporting off. What are some different opinions on this? Are there any best practices associated wi...

What is stdClass in PHP?

I have search in Google but couldn't find an answer. Please define what is stdClass. ...

read all data recieved from a socket in PHP

I'm writing a simple telnet client library. I open sockets using fsockopen() and read and write to the socket using fgetc() and fwrite(). I use fgetc() instead of fread() to handle Telnet special commands and options like (IAC, ...). the problem is that most of times I'm reading from the socket, it takes too long to return. as I have pr...

How is Yii Framework doing in PHP world? Any good or bad recent experiences.

Personally I like the many features that it offers. I have seen some questions but they are old, so want to gather some response from people who used it or planning to use it. If you are planning to use, how did you arrive at this framework? ...

Different Image depending if user has already voted

I am developing a links voting site, and I have this function, to check if the user already voted the link: function has_voted($user) { try { $db = parent::getConnection(); $query = "select id from votes where username = '$user' and article_id = $this->id"; $results = parent::exe...

Can some explain what this script does please

class person { var $name; var $email; //Getters function get_name() { return $this->name; } function get_email() { return $this->email; } //Setters function set_name( $name ) { $this->name = $name; } function set_email( $email ) { if ( !eregi("^([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,...

Implement PHP interface such that object instance can be passed as array type argument?

In PHP it is possible to specify argument types although they call it type hinting. I am implementing an interface where one of the functions specifies an array as the argument type: function myFunction(array $argument){ } I'd like to define a class, an instance of which can be used as the argument for this function. In other words i...

Which is better: require_once? or if (!defined('FOOBAR')) require? or something entirely different?

Assuming PHP version >= 5.2, which is a better solution for managing includes: require_once DEFPATH . 'config.inc.php'; or if (!defined('FOOBAR')) require DEFPATH . 'config.inc.php'; or something entirely different? Site does not use a front controller or autoloader. Typical number of files needed to be included is 3 - 8. I've ...

Internet Facing SSRS Report

I am designing a website using PHP 5.2.9 and MS Sql Server 2005. I have an SSRS report and I want to set it up so that people over the internet can access it (after they put in a username and password, but i can figure that part out). Our website is hosted locally on a web server and the database is on a seperate server. I haven't set...

OO Design: Returning a child class from a parent

I'm still a novice when it comes to polymorphism so I hope I can phrase my question correctly. Let's say I have tables in my Database - Dog, Cat and Mouse. I want to be able to call something like: $animal = new Animal("dog", 12); with the animal class being something like: class Animal { protected $id; protected $legs; prote...

How to implement Template Inheritance (like Django?) in PHP5

Is there an existing good example, or how should one approach creating a basic Template system (thinking MVC) that supports "Template Inheritance" in PHP5? For an example of what I define as Template Inheritance, refer to the Django (a Python framework for web development) Templates documentation: http://docs.djangoproject.com/en/dev/to...

php count() to help give html elements set attributes

I am building a menu that I want to display in a certain way. However, it is to be populated from a database so it cannot be hard-coded. Essentially I want the 'li' tags to appear in set places when they are created and was hoping that I could set their class using php count() and already having the css set up for them. Basically, the ...

UTF-8 & IsAlpha() in PHP

Dear, I'm working on a application which supports several languages and has a functionality in place which tries to use the language requested by the browser and also allows manual override of this function. This part works fine and picks the correct templates, labels, etc. User have to enter sometimes text on their own and that's wher...

How to gather torrent stats based on tracker?

Having read the torrent specification over and over, I'm still having troubles gathering the number of peers (say, seeds and leechs)from a [BitTorrent] tracker using PHP. Having access to the server is no problem at all. Can anyone point me in the right direction? Specification here: http://wiki.theory.org/BitTorrentSpecification#Trac...

forcing access to __PHP_Incomplete_Class object properties

I'm writing a module for a php cms. In a function (a callback) I can access an object that comes from the framework code. This object is of type ' __PHP_Incomplete_Class' because the needed header file is not included before the session starts. I cannot include it without hacking the core cms code. I wonder if is possibile to access t...

Is there a built in way in Zend-Form to hide the value of the SUBMIT input field?

If I build a form: $search_words = new Zend_Form_Element_Text('text'); $search_words->setRequired(true)->setDecorators(array(array('ViewHelper'))); $form->addElement($search_words); $go = new Zend_Form_Element_Submit('gogogo'); $go->setDecorators(array(array('ViewHelper'))) ->setIgnore(true); $form->addElement($go); ...

Is there a good role based workflow engine in PHP?

I am looking for role based access and work flow engine that allows for simple configuration. ...

Why is calling (ImageMagick) convert.exe from PHP script resulting in an unresponsive page?

* This is now resolved * by clearing the temp folder in windows! Some info - Windows 2003 server, IIS 6 ImageMagick 6.3.3 PHP 5.2.0 I am using ImageMagick to resize images on the server and I think this has recently been causing problems. What I am noticing is that when my PHP script executes the ImageMagick command the webpage freeze...