php

Where can I find a good MediaWiki Markup parser in PHP?

I would try hacking MediaWiki's code a little, but I figured out it would be unnecessary if I can get an independent parser. Can anyone help me with this? Thanks. ...

How can I replace only the captured elements of a regex?

I'm trying to extract only certain elements of a string using regular expressions and I want to end up with only the captured groups. For example, I'd like to run something like (is|a) on a string like "This is a test" and be able to return only "is is a". The only way I can partially do it now is if I find the entire beginning and end...

Moving around key order in a multi-dimensional array

How can I "reorder" the keys in a multi-array? For example, I have: $arr["abc"][0] = "val1"; $arr["abc"][1] = "val2"; $arr["abc"][2] = "val3"; $arr["xyz"][0] = "val4"; $arr["xyz"][1] = "val5"; $arr["xyz"][2] = "val6"; And I want it to be: $arr[0]["abc"] = "val1"; $arr[0]["xyz"] = "val4"; $arr[1]["abc"] = "val2"; $arr[1]["xyz"] = "val...

How to separately recognize the data sent over to php?

Hello I am sending two data to my php from my javascript: http://forum.research.bell-labs.com/zeeshan/publication/phpwithmysql11111.php?rowid=BL09.00001,0 1) BL09.00001 2) 0 How do I recognize them separately in my php? I was trying to do: $job=$_GET[rowid]; echo($job); this gives me both the fields. ...

PHP, URL rewriting with htaccess, and Microsoft IIS Url Rewriting

I am used to working with Apache servers, so when mod_rewrite is enabled, I can create an htaccess file and use URL rewriting. Here's my htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php ...

PHP desktop applications

Hi, I have quite a few years experience of developing PHP web applications, and have recently started to delve into Python as well. Recently I've been interested in getting into desktop applications as well, but have absolutely no experience in that area. I've seen very little written about PHP-gtk and wonder whether it's really a good ...

PHP framework URL conventions

A lot of frameworks use URL conventions like /controller/action/{id} which is great, but if you need any configuration beyond that, it's up to you to write your own routes. How would you handle URLs like /users/{id}/friends on the backend? (to list all of a user's friends) I'm thinking that in the controller, something like this would ...

Using preg_split to go from 'hi how are you' to [hi, how are you]

I want to split a string into two parts, the string is almost free text, for example: $string = 'hi how are you'; and i want the split to look like this: array( [0] => hi [1] => how are you ) I tried using this regex: /(\S*)\s*(\.*)/ but even when the array returned is the correct size, the values comes empty. What should ...

Manual Sub-Domain Construction

I want to create subdomains manually on my website as in my current hosting plan I have no option of creating a subdomain. I think perhaps this is possible using .htacces??? Please give two examples in answers for agrimgupta DOT com/oranges --> blog DOT agrimgupta DOT com/ and agrimgupta DOT com/work/UniV --> study DOT agrimgupta DOT co...

In symfony, how to set the value of a form field?

I'm overriding my doSave() method to basically do the following: I have a sfWidgetFormPropelChoice field that the user can either choose from, or type a new option. How can I change the widget's value? Or maybe I am approaching this the wrong way. So here is how I overrode the doSave() method: public function doSave($con = null) { // S...

How do I use PHP's preg_match to validate strings?

Please tell me how to use the various symbols used for expression matching in preg_match function of PHP. Besides basic information, please give example for checking a valid e-mail address and a string that should not contain / : ; { } * & ...

How to create wordpress like functions in PHP?

Howdy, To pass variables into functions, I do the following (as other people I'm sure): function addNums($num1, $num2) { $num1 + $num2; } addNums(2, 2); My question is how would I structure a function to act like Wordpress: wp_list_categories('title_li='); Essentially I am looking for a way to create a key/value pair in my fu...

Space Before Ajax Response (jQuery, PHP)

I'm using jQuery to make ajax requests. The data is getting to PHP nicely, but the response isn't getting back to javascript properly. Somehow there is a space before the response. I know this because Firebug says so and my code doesn't work because the space is there. When I expect there to be a space it works fine. Any ideas as to what...

Advanced Web Development Tutorials

While I can find the answer to almost any specific question I have concerning PHP + MySQL development, one resource I haven't been able to find is good solutions to advanced problems. I want to implement a minor messageboard type system that can be queried by AJAX, but it I have too many specifications for it to be filled by a prebuilt ...

PHP alternative to trac?

Are there any PHP alternatives to Edgewall's Trac solution which works on Python, and not really portable? Duplicate: Is there an equivalent to Trac written in PHP? ...

How to Deal With Codeigniter Templates?

I'm fairly new to MVC framework and found codeigniter recently. I'm still learning everyday but one problem is it's template engine. What is the best way to create it's template? CakePHP comes with it's own template library so how to the same with codeigniter? ...

I have latin1 encoded data sitting in a UTF-8 mysql database, how do I fix this?

I have latin1 encoded data sitting in a UTF-8 mysql database, how do I fix this? There is no original data to go from unfortunately. I figured out this much as the only way I could display the data correctly was to set everything latin1 in PHP, HTML and MySQL. Once this is completed, I can change everything back to utf-8 in my html an...

Using htmlentities with BBCode

Hi, What I am trying to achieve is a sound method for using BBCode but where all other data is parsed through htmlentities(). I think that this should be possible, I was thinking along the lines of exploding around [] symbols, but I thought there may be a better way. Any ideas? ...

Do I really need to switch from VARCHAR to VARBINARY for UTF-8 in Mysql & PHP?

Do I really need to switch from VARCHAR to VARBINARY and TEXT to BLOB for UTF-8 in Mysql & PHP? Or can I stick with CHAR/TEXT fields in MySQL? ...

Simple User management example for Google App Engine ?

Hi, I am newbie in Google App Engine. While I was going through the tutorial, I found several things that we do in php-mysql is not available in GAE. For example in dataStore auto increment feature is not available. Also I am confused about session management in GAE. Over all I am confused and can not visualize the whole thing. Please a...