php

Whats a great dev setup for working with PHP + MYSQL?

I've been a PHP Dev for many years now, and it just dawned on me that maybe I could be using better development tools. For example, my typical setup for development is Notepad ++ Dev WAMP Server (local machine usually) CodeIgniter framework (lately I've fallen in love with it, as it speeds up deployment for me, big time.) PHPMYADMIN ...

How to verify a given string is a real URL, in PHP?

I need to find the best way (in terms of performance) to find if a given string is a URL. REGEXP won't help, as www.eeeeeeeeeeeeeee.bbbbbbbbbbbbbbbb.com is a valid url name but not in any network known to man. I am thinking using CURL and see if I get status 200 back or just file_get_contents and analyze the result. Is there a better way...

USPS API confusion

If anyone has any experience with the USPS delivery confirmation API, I'd really appreciate any insight I can get... I am using PHP and cURL to send an XML request to the D.C. API. When I send the response through cURL, I get nothing. No error response, no XML, or anything. When I send the XML through a browser, I get an error respon...

Revision comparision in PHP

Hi all! Say, I have var1 and var2 both with a string value. Var2 is a revision of var1 with minor changes: var1: Hello, world1 var2: Bye bye, world! Now I want this output: <span class="removed">Hello</span> <span class="new">Bye bye</span>, world<span class="removed">1</span><span class="new">!</span> much like SO's way. How c...

Zend Platform - Include path in JobQueue scripts

I have a script to be run by a job I set up in Zend Platform, and that script needs to make use of the Zend Framework. I can run the script from a browser or command line with no problem, but when I set a job to run it in ZP, the script errors out because none of the required Zend library files can be found. Echo tests using get_includ...

HTTP POST with custom header from iphone to PHP script. How do you read the header?

This code works, and I can see the request go out to my php script through charles with my custom header GUID attached. NSMutableURLRequest *loginRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:feedURLString]]; NSData *myRequestData = [NSData dataWithBytes:[myRequestString UTF8String]length:[myRequestString lengt...

PHP/MySQL Reservation System

I'm currently working on an Equipment Reservation System for my school. Here's basically what my tables look like: tblEquipment: id name description 1 Camera Takes pictures 2 Projector Projects images 3 Stereo Plays music tblEvents: id equipmentID start...

Is it possible to retain a variable in memory (RAM) in PHP?

Hello guys, I'm studying high-performance coding for websites in PHP, and this idea popped into my mind: We know that accessing a database uses a significant amount of CPU usage, so we cache such data, saving it to the HDD. But I was wondering, can't it rest in the RAM of the server, so I can access it even more faster? ...

Does PHP's get_defined_functions() show available functions or functions being used?

I just discovered the get_defined_functions() function in PHP, I was checking it out, it list all the functions. It in addition to php's built in functions, it list 176 function I have made for my site. I have a question about it, are all the listed functions from this being loaded, like taking up resources or is it just showing they...

Is it bad practice to construct a child class with a parent object?

I have a search class that I am using to fetch results from two different sources and combine them together. The Search class is the parent and has two children A and B which extend Search. In the Search class, I have a method called fetch() which instantiates the two child objects to get their results. It looks something like this: ...

Show data sorted by parent objects

Hey guys, i have a problem and don't really know, what to search for to find a solution. Description: I have a mysql table with the following colums "id", "name", "value", "parent" with "id" as primary key. "id" is a autincreament number, "name" is the name of the category, "value" is the value of the category and "parent" is the pare...

Semi-Complicated PHP/MySQL Select Statement

Hello all, I currently have 3 tables, which I'm using for people to make reservations for certain pieces of equipment. Here are my tables: tblEquipment: id name description 1 Camera Takes pictures 2 Projector Projects pictures 3 Laptop Portable Computer tblEven...

php fopen relative path broken - mystery

I know "something must have been changed" but my code seems to have broken over night for no reason. My server directory structure is something like this: / /scripts /audit /other_things I have a script (let's say it's called "/scripts/MyScript.php") in the "scripts" folder which gathers data from a webpage using curl, an...

Spellchecking in PHP

I am looking to possibly add in some sort of spellchecking/correction in PHP, is there anything that is recommended? Is this a slow process? It would be for user submitted blog posts and forum post, possibly even just be used in an admin area if performance is not good. ...

Simple PHP classes question.

So I have: class foo { public $variable_one; public $variable_two; function_A(){ // Do something $variable_one; $variable_two; // If I define variable_3 here! $variable_3 // Would I be able to access it in function_B? } function_B(){ // Do something $variable_4 = $variable_3 } } $myObj = ...

[Web Development] - Lua vs PHP/Python/JSP/etc...

I'm about to begin my next web development project and wanted to hear about the merits of Lua within the web-development space. How does Lua compare to PHP/Python/JSP/etc.. for web development? Any reason why Lua would be a poor choice for a web application language vs the others? ...

Custom RSS feed in Dokuwiki

I'm using Dokuwiki to populate a site with a known set of pages. Say, foo_1 through foo_9. The content of those pages will change, but the names and locations never will. I want to provide a full-content RSS feed in a particular order of just those pages: foo_1 foo_2 foo_3 ... foo_9 Using the default syndication items it's not possi...

Unixtime & mysql

Hi guys, I have a field on my table which is called X, and I store unixtime(php -> time()). My question is: How can I list all the months from my DB, something like: 6.2009 8.2009 etc.. And my second question is: How can I make a query to list all the informations based on a month and year on the same field X(i store unixtime),...

What best shopping cart application to use?

I am looking for a PHP based open source full featured shopping cart application which is easiest to learn and to theme.... I don't want to write my own because I'm concerned about the security and I don't really make very handy admins. Plus I have no experience with online selling and this is my first shot. I'm thinking between Magent...

Why is my getter magic method using a class instance as an index?

here's my getter: public function __get($field) { if ($field == 'userId'): return $this->uid; else: return $this->fields[$field]; endif; } here's my constructor public function __construct() { $this->uid = null; $this->fields = array( 'username' => '', 'password' => '', ...