php

Find out if a method exists in a static class.

I want to check is a function exists in a library that I am creating, which is static. I've seen function and method_exists, but haven't found a way that allows me to call them in a relative context. Here is a better example: class myClass{ function test1() { if(method_exists("myClass", "test1")) { echo "Hi"; ...

Creating unique usernames

So I have a system that is going to allow specific users the ability to create new user accounts but, for several reasons, they cannot get a listing of all users on the system. That could make creating new user names difficult (if they can't see a list of used names) Are there any standard ways of creating a user name out of a person's...

How can I easily change the order of a string. I need a string function

If I wanted to take a first name / last name string separated by a comma and change the order, how might I go about that? last name, firstname should be changed to firstname lastname (without the comma) Thanks. ...

godaddy header issues

on godaddy's servers if any information exists before a redirect is done ill get that header error on the page. but on my local pc that doesnt happend. how can i set up wamp to act the same as godaddys servers do? to show me all header errors i should have errors turned on but what else do i need to turn on. so i can save me some time a...

Using <input type="file"> with a FTP value

Is it possible to get access to a file on my FTP doing the following? <input type="file" name="final" id="final" value="http://www.blah.com.au/artwork/&lt;?=$OrderID?&gt;/&lt;?=$ItemID?&gt;/Final/Final.pdf"&gt;; I know that this specifically didn't work for me, but is there a way to get the file from the FTP so I can send the informat...

PHP - Get number of pages in a Word document

Is there a way to count number of pages using PHP for existing Word documents? I appreciate for the help. Thanks ...

ASP.Net equivalent of PHP's file_get_contents ( 'php://input' );

Is there an equivalent method for this in ASP.Net? ...

PHP MySQL in 1 class & 1 file

Hi, I'm looking for a many-in-one PHP MySQL 1 class/file with the features: Connect to DB server Select database CRUD Prepare & binding Thank you in advance! ...

Is PHP for Windows the same as Linux, Mac, etc.?

If I write PHP (php5 if it matters) on Windows and Apache is the same as writing PHP on another OS and Apache? I do not mean things like file paths. Thank you. ...

How to make array loop faster in PHP.

Is there a way to make this faster? while ($item = current($data)) { echo '<ATTR>',$item, '</ATTR>', "\n"; next($data); } I do not like that I need to create new variables like $item. ...

PHP Xml Attribute Parsing

I am Parasing XML currently using: $data = simplexml_load_string($xmlFile); foreach($data->item as $key => $current){ echo($current); } However I'm wondering, if a hit an element that looks like this: <thumbnail url="http://foo.bar" height="225" width="300"/> How do i pull the inner parts of this? (height, url, width) Thanks! ...

How to Make PHP Faster: Does String Creation Have No Cost?

In this question a code bit is presented and the questioner wants to make it faster by eliminating the use of variables. Seems to me he's looking in the wrong place, but far be it from me to know. Here's the code while ($item = current($data)) { echo '<ATTR>',$item, '</ATTR>', "\n"; next($data); } Seems to me that the recreat...

MySQL: How to get "this week's date" using the current date?

Hi, I have this SQL query about getting the 5 events today: SELECT n.nid, n.type, n.title, nr.body, nr.teaser, FROM_UNIXTIME(e.event_start) start_date, FROM_UNIXTIME(e.event_end) end_date FROM node n LEFT JOIN event e ON n.nid = e.nid LEFT JOIN node_revisions nr ON nr.nid = e.nid WHERE n.`type` = 'event' AND NOW() BETWEEN FROM_UNIXTIME...

How do you make a WordPress front page template in the Carrington blog theme?

I tried adding a frontpage.php file to the content directory, but that wasn't being loaded. Now, I've added the following snippet to assure I'm getting a context of 'frontpage': add_filter('cfct_context', 'scompt_front_page_context'); function scompt_front_page_context($context) { if( is_front_page() ) return 'frontpage'; ...

Is there a way to add a PHP SimpleXMLElement to another SimpleXMLElement?

The "addChild" method of SimpleXMLElement seems like it should be the right choice, but it apparently only takes strings representing the tagname of the new child. There's the object-ish notation for referencing nodes of the tree and setting them, e.g. $simpleXMLNode->child = value, but that only seems to work for simple text/numeric va...

PHP Mysqli prepared not creating statement object

Hi, I am using the php mysqli extension with prepared statements, but on one query it is not creating the query object. Here is the code: $sqlq = "SELECT id,name FROM productcategories JOIN products ON productcategories.productid = products.id WHERE categoryid=?"; if($allsubcats) { foreach($allsubcats as $key => $data) ...

license and protect php script

I am interested to use http://www.phplicengine.com to protect my php code and license my php script but have no clue how good it is. is here a PHPLicengine user who may help me please? ...

trying to understand something about php gd

if i have something like this <?php $image = imagecreate(300,20); $background = imagecolorallocate($image,0,0,0); $foreground = imagecolorallocate($image,255,255,255); imagestring($image,5,5,1,'sarmenhb, $foreground); header('Content-type: image/jpeg'); imagejpeg($image); ?> how does php know the first imagecolorallocate function wi...

What is expire header and how to achive them in ASP.NET and PHP?

Today I have checked performance statistics of my website using YSlow. I got a warning (or error may be) which is as below Add Expires headers There are 15 static components without a far-future expiration date. * (no expires) http://www.example.com/video/css/global.css * (no expires) http://www.example.com/video/js/global.js ...

Free Php Script to show DataGrid

I want to show an online editable datagrid like in asp.net to the user. My development is in php and i have mysql database. Is there any free of cost alternative which is ajax powered as well for me to enable the user to add/edit/modify data online. I have a MQSQL Database. Ain't there any control which can do databdinging to a mysql da...