php

Limiting characters of password

i have a simple question.. in registration script.. how can i set the limit character of a password. sample: minimum character is 6.. so what will be the code. please help me. :-( ...

How to define the sequence of array elements?

I have got the following array. Array ( [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => h [9] => i [11] => j [13] => k [14] => l [15] => m [...

Fieldset implementation in Symfony forms

Hello, on the project I am writing with Symfony, there will be fieldsets in forms very often, so I would like to create a mechanism so that I can group fields by fieldsets and still use the __toString() method of my forms. On this page, I read about the sfWidgetFormSchema, and how it could be considered as a widget, which enables to nest...

PHP String Parsing Strip *First* enter/return space from form textarea

How do you strip the first (before any visible text) enter/return space from text taken from a variable (submitted from a textarea)? ...

Using global variables in CakePHP Shell scripts

Using CakePHP's shell scripts I'm having problems accessing constants, which I normally set within config/bootstrap.php. Is this because using shell scripts I'm not going through the normal dispatcher routine? What's the best practice for defining constants across shell scripts? Thanks. ...

Which regexp php is using for filter_var($url, FILTER_VALIDATE_URL)?

Hello, filter_var($url, FILTER_VALIDATE_URL) seems to be great way to detect if $url contains url or not. Is there any way to see what regular expression this function uses for detecting? Thank you ...

Manipulating Microsoft Word Office 2007 .docx document from PHP

I need an option from within PHP to Manipulate .docx (Microsoft Office 2007) document. I need to: Read the internal text Convert to .html To view them inside a browser. To replace text. I know I can use Word Automation, creating a COM object of Microsoft Word, but it's too slow, unstable and I have to have it installed on the server...

data is not received in target page.

I m tring to send data using post method from one page to another. but i m not receiving data in target page and getting error of undefined index name_of_variable when i m trying to get that data using $_REQUEST[] method I m using following code: ---- --- ...

Character-wise string diff in PHP

In short I am looking for something like google-diff-match-patch in PHP. I have had a look at some similar questions at SO, and also at the algorithm provided here, but all of them fail: diff("draßen", "da draußen") should not give <del>draßen</del> <ins>da draußen</ins> (which is kind of stupid for my purpose, because I want to...

PHP If Script is being fetched by URL...

Hello, I have an RSS feed, users will be using it to rip content to display on there site. However I need todo a check that the site doing so has access. Its just occurred to me that I have no idea in PHP how to detect if the script is being read by a server and what the URL is of the fetch. Is it possible? ...

Wordpress Custom URL Rewrites

I have links in my site that pass queries to pages that query from an external database. This works fine e.g. mysite.com/catalog/?tl=flooring however i want to rewrite this url to appear as mysite.com/catalog/flooring Ive tried modifying the rewrite rules in wordpress but it always displays the index page add_filter('rewrite_rules...

Web Service using SOAP WDSL with PHP

I've been trying to use a Web Service which has the WSDL file below. The bit I'm not sure about is what I am supposed to pass or do with the first part of it. It asks for a personaldetails object with a tns type to be passed to it but I don't understand what that means? The actual method I am trying to use is called PersonalDetails_Up...

mkdir ignore mode, but use recursive parameter

PHP's mkdir function has the following signature: bool mkdir ( string $pathname [, int $mode = 0777 [, bool $recursive = false [, resource $context ]]] ) I would like to call this function specifying the $pathname and $recursive set to true, but I wouldn't like to specify the $mode parameter. We control permissions on new files/directo...

Turning off the html interpretation in php

Hi everybody, I have a problem with getting some html value stored in a php array: $data = array("Name"=>'<div style="color:red"></div>'); while(list($key,$val) = each($data)){ print_r($key." => ".$val) ; } The problem is that the script (put inside html tags) returns: Name => Foo Bar So, the div (so the html) is interpretated. ...

PHP Pass by reference in foreach

I have this code: $a = array ('zero','one','two', 'three'); foreach ($a as &$v) { } foreach ($a as $v) { echo $v.PHP_EOL; } Can somebody explain why the output is: zero one two two . From zend certification study guide. ...

How would I trim the input to a JQuery auto-complete box?

Is there any way to trim (remove leading/trailing spaces) the input entered by a user into a jQuery auto-completing text <input> box before it is matched against the list of names:values? I currently have a textbox in which users are meant to enter names. The names are then matched against a list of name:value pairs by jQuery: <script t...

php Includes header with User Name

Hi I have a php includes on my site for header and footer on each page. I am changing the site to allow users to log in and out etc. How can I pass things like username to the header? Also I will want the header to display Log In when no user name is present but Log Out when a username is present. Any help appreciated. Richard ...

Problem getting author from a wordpress RSS feed using SimpleXmlElement

Hay, i'm trying to parse an RSS feed from a wordpress blog. So far everything is working as expected, here's my code <?php $feedUrl = "FEED URL"; $rawFeed = file_get_contents($feedUrl); $xml = new SimpleXmlElement($rawFeed); $channel = $xml->channel; $items = $channel->item; foreach($items as $item){ ec...

Doctrine: How do i add elements to a relationship

i think my question is not clear but i try to illustrate my point here. assuming i have a many to many, self referencing relationship where a user can be a teacher (say u post answers at SO) and a teacher can be a student (u may answer questions but may ask too) too. namespace Entities; /** @Entity @Table(name="users")) */ class User {...

Parsing string using PHP.

Hi, I am using PHP & want to parse given string: Let say $str = '<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/W-WKYIgGBbU&amp;amp;hl=en_US&amp;amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> <embed src="http:...