php

MySQL - Skip Duplicate WordPress Entries

I'm writing a script to display the 10 most recently "active" WordPress blog posts (i.e. those with the most recent comments). Problem is, the list has a lot of duplicates. I'd like to weed out the duplicates. Is there an easy way to do this by changing the MySQL query (like IGNORE, WHERE) or some other means? Here's what I have so far:...

What should every PHP programmer know ?

I would to be a PHP/Mysql Programmer what is the technologies that i must know ? Like :- Frameworks IDEs Template Engines Ajax and Css Frameworks please tell me the minimum requirements that i must know , and tell me your favourite things in the previous list ? thanks ...

multiple subpackages for phpdoc

Is it possible to have a file belong to multiple subpackages? For example: /** * Name * * Desc * * @package Core * @subpackage Sub1 * @subpackage Sub2 */ Thanks! ...

Problem with sending cookies with file_get_contents

Hi, i'm trying to get the contents from another file with file_get_contents (don't ask why). I have two files: test1.php and test2.php. Test1.php returns a string, bases on the user that is logged in. Test2.php tries to get the contents of test1.php and is being executed by the browser, thus getting the cookies. To send the cookies wi...

Convert Speex files to MP3, programatically?

Is is there some sort of library that would allow me to convert a speex file to an mp3 file? If it were do-able from php that would be even better, but really anything would probably work. ...

PHP coding standards

I've been looking for some guidelines on how to layout PHP code. I've found some good references, such as the following: http://www.dagbladet.no/development/phpcodingstandard/ and this question on SO. However, none of that quite gets to what I'm specifically wondering about, which is the integration of HTML and PHP. For example: is ...

PHP function which does syntax color parsing for multiple languages?

I'm doing a PHP site which displays code examples in various languages (C#, PHP, Perl, Ruby, etc.). Are there any PHP functions which add syntax coloring for these and other languages? If not, I would at least like to find that one built-in PHP function which does syntax coloring for PHP code, can't find it anymore. Thanks. ...

Where to use Zend Framework translation tool

Hi! I have the whole MVC-Model set up and use HTML views as templates. But I have german strings in there that I would like to translate to other languages at some point. What is the best way to do this? I know I have to use Zend_Translate, but do I have to implement a single call to a translate function for every word that I have in m...

How Can I Display Static HTML After I've Used die() in a PHP Block?

Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){ die(); } else{ #Do something } ?> </body> <html> I hope the purpose of this code is straightforward. If a certain condition is met (ie can't connect to database), then the program should die, but otherwise it should ...

How can I tell when a MySQL table was last updated?

In the footer of my page, I would like to add something like "last updated the xx/xx/200x"; with this date being the last time a certain mySQL table has been updated. What is the best way to do that ? Is there a function to retrieve the date ? Should I make an access to the database everytime my footer is displayed ? ...

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...

JSON - Slashes and application type..refactoring

Hi My code works (yeah!) which sends json to a server.. would appreciate any thoughts on refactoring 1) My C# code sends this json to the server {\"firstName\":\"Bill\",\"lastName\":\"Gates\",\"email\":\"[email protected]\",\"deviceUUID\":\"abcdefghijklmnopqrstuvwxyz\"} Which I have to get rid of the slashes on the server side....not ...

utf-8 and htmlentities in RSS feeds

I'm writing some RSS feeds in PHP and stuggling with character-encoding issues. Should I utf8_encode() before or after htmlentities() encoding? For example, I've got both ampersands and Chinese characters in a description element, and I'm not sure which of these is proper: $output = utf8_encode(htmlentities($source)); or $output = htmle...

How to remove duplicate values from an array in PHP

( can't believe this hasn't been asked in SO yet... ) How can I remove duplicate values from an array in PHP? ...

How to remove duplicate values from a multi-dimensional array in PHP

How can I remove duplicate values from a multi-dimensional array in PHP? Example array: Array ( [0] => Array ( [0] => abc [1] => def ) [1] => Array ( [0] => ghi [1] => jkl ) [2] => Array ( [0] => mno [1] => pql ) [3] => Array ( [0] => abc [1] => def ) [4] => Array ...

How do I replace 'php3' with 'php' inside every file in a directory.

Hopefully a nice simple one. I've got a php3 website that I want to run on php 5.2 To start with I'd just like to have every reference to the current "index.php3" _within_each_file_ (recursively) changed to "index.php" and then move on to worrying about globals etc. K. Go! :) Update: Thanks a lot! I realise that my question missed ...

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...

Pagination Problem [PHP]

So I'm doing this in PHP but it is a logic issue so I'll try to write it as generically as possible. To start here's how this pagination script works: for (draw first three pages links) if (draw ellipsis (...) if there are pages between #1's pages and #3's pages) for (draw current page and two pages on each side of it links) if (draw ...

Learning how to use AJAX with CodeIgniter

It's kind of embarassing that I find it so difficult to learn JavaScript, but .. Let's say I have a really simple controller like this: class front extends Controller { public function __construct() { parent::Controller(); } public function index() { //nothing! } public function test () { ...

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...