php

PHP: ARP?? Replying to an ARP Request

I know this may be an impossible question, since we are dealing with two different layers of the network, but is it possible to send a reply to an ARP request using PHP sockets? If so how....such as What port and ip address would you connect the socket to? Again, I understand that arp doesn't use a port number...at least not that I can...

fetch php method comments

I want to fetch a method's comments,take below method for example: /** * Returns the regex to extract all inputs from a file. * @param string The class name to search for. * @return string The regex. */ public function method($param) { //... } the result should be Returns the regex to extract all inputs from a file. @param string ...

Parent Object in php

Hi guys, is there a way to traverse an object to get the parent object data? With "parent object" I don't mean the parent class, but literally object. Here an example, in a javascripty world :-) : $parent->test = "hello world!"; $parent->child = new B(); It would be great If I could access all the data from parent in the child obje...

if an object property is another object, how do i access that object-property's property or method in smarty?

class A { public $property1; public $objB; public __construct(){ $this->property1 = 'test'; $this->objB = new B(); } } class B { public $title; public __construct(){ $this->title = 'title1'; } } so now i do this in the .php file $a = new A(); in my .tpl i want to display $a->objB->title how do i do that...

How to make a string HTML compatible using PHP?

Let's say I have this string: Hello &, how are you? I'm fine! Is there a function that will convert this to: Hello &, how are you? I'm fine! Also, why does "'" sometimes show up as: � on sites? What am I missing? ...

Converting arrays into another format (PHP)

Hi.. i want to convert this array Array ( [2] => Array ( ) [4] => Array ( [12] => Array ( ) [13] => Array ( [16] => Array ( ) ) ) [5] => Array ...

How do I write extensions for dreamweaver cs4? What limitations are there on what extensions can do?

I use dreamweaver cs4 as my main php coding editor. I am wondering if anyone has any information on how exactly to write a dreamweaver extension? Also, what can / can't you do ? Specifically, I want to write an extension that will allow me to quickly search my file tree and then open a file, via a quick auto complete search box locate...

Rotate a string N times in PHP

I'm looking for a way to rotate a string to the left N times. Here are some examples: Let the string be abcdef if I rotate it 1 time I want bcdefa if I rotate it 2 time I want cdefab if I rotate it 3 time I want defabc . . If I rotate the string its string length times, I should get back the original string. ...

Php plugin to replace '->' with '.' as the member access operator ? Or even better: alternative syntax ? (<php+ $obj.i = 5 ?>)

Present day usable solution: Note that if you use an ide or an advanced editor, you could make a code template, or record a macro that inserts '->' when you press Ctrl and '.' or something. Netbeans has macros, and I have recorded a macro for this, and I like it a lot :) (just click the red circle toolbar button (start record macro),t...

Creating Drupal taxonomy terms from code?

What is the function used to create taxonomy terms in Drupal from the code? ...

How to save a neatly formatted XML file using Simple XML?

What's the "trick" to save an XML file that visually would result neatly formatted? such as: <xml> <item>foo</item> </xml> and not: <xml><item>foo</item></xml> ...

Finding first available ID from an array

Hi, Given an array like this: Array => ( [0] => 1, [1] => 2, [2] => 3, [3] => 5, [4] => 6 ) What is the easiest way to find the first 'available' ID in that array that is, the first value in the sequence [1,2,3...n] that does not exist in the array? In this case, the correct answer would be 4. I can do this using some whi...

How do I replace double quotes with single quotes

Hy everyone how can I replace "" // i think its called double quotes with '' // i think its called single quotes using PHP ? ...

Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' with pdo

$db = new PDO('mysql:dbname=xnews;host=localhost;port=' . $LOCAL_DB_PORT, $LOCAL_DB_USER, $LOCAL_DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'") ); reports: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' Is it renamed? ...

Is there better way to access configs from Conroller plugin in Zend Framework

Just need get some vals located in application.ini(main ini) in the Controller plugin I know I can create an instance of Zend_config_Ini but would like to use the existing resource (application.ini is already used in Front Controller) ...

ejabberdctl does not work from PHP

I am trying to call ejabberdctl from a PHP file, but it is failing with the following error : Failed RPC connection to the node ejabberd@localhost: nodedown The node is running, i have checked this by logging into the server. When the php script is run this is the error i see in /opt/ejabberd-2.1.2/logs/ejabberd.log shows : =ERROR R...

Displaying values with leading zeros

I want to display digits with leading 0s, for values of a single digit, specifically for displaying hours and minutes. How do I do that in PHP? ...

match and replace using php

I have a html file that contains urls that start with ftps, http, https, mms, ed2k.. and in certain paragraphs. I need to sort these links and remove all the links that start with mms://. I tried preg_replace but it doesnt work coz many links are too long. can someone suggest a good method to remove the links using php? ...

"Web interface" to PHPUnit tests?

Is there a simple "Web interface" to running PHPUnit test suites? i.e. a PHP script that runs the test on the command line, and outputs a nicely formatted HTML result. I develop web applications, and the day-to-day workflow usually switches between the IDE and the browser. I would like to have the unit testing in the same environment. ...

how to submit a form and show the result in that page

hey guys im using a form in php to submit some information into my database so i used two function to do this but how to show the result in th same page that has the form ...