I have a foreach loop, that will loop through an array, but the array may not exist depending on the logic of this particular application.
My question relates to I guess best practices, for example, is it ok to do this:
if (isset($array))
{
foreach($array as $something)
{
//do something
}
}
It seems messy to me, ...
I'm using PHP 5's preg functions, if it makes a difference.
Consider the regular language matched by the following regular expression.
([^{}] | {[0-9a-zA-Z_]+})*
The language consists of strings of any number of characters, with special embedded tags marked off by left and right curly brackets, which contain a string of one or more a...
If you are to install PHP on IIS, what PHP extensions would be good to be installed along with the ones that come by default with PHP? Also, any security extensions/configurations preferred usually?
I am thinking Fast CGI, CURL and GD library are required ones. Any other suggestions?
I am installing it for a friend, and he asked me to ...
I would like to get the links from the search results. Can someone please help with with the regular expression to do this? I've got this, and it doesn't work:
preg_match_all("/<h3(.*)><a href=\"(.*)\"(.*)<\/h3>/", $result, $matches);
...
I asked a similar question earlier but I'll ask it again in a different way. How can I indent categories and endless sub categories that I have in a select drop down menu using PHP & CSS?
Here is my PHP code.
while (list($id, $parent_id, $category) = mysqli_fetch_array($r, MYSQLI_NUM)) {
// Add to the select menu:
echo '<optio...
I use mstmp to send mail from various smtp account. Using PHP's mail command it sucessfull sends mail from mstmp using the default account.
However, I want it to let me specify which smtp account to send from. Using mstmp you do that with the following command: msmtp --account=svh where svh is the smtp account you name. More on msmtp ...
HTML code :
I echo this content in php file, In result i get only the 'Contact Us' Remaining part does not display the html form
<div > Contact Us
<form name="profile" action="" method="post">
Name : <input type="text" name="fullname" id="fullname" />
Email : <input type="text" name="email" id="email" />
Mobile : <input...
I have connect Authorize.net using direct connection. Currently we have used Visa and American Express for payment .
For adding this two feature "payment for MasterCard and Discover" we have need to do some changes in code or not?
...
I want to get total of elements of each row at the end of that row and total of elements of each column at the end of each column.
For Example:
I have an array with digits values like this:
$twoDimArr = array( array("1" , "2" , "3" , "4"),
array("1" , "2" , "3" , "4"),
array("1" , "2" , "3" ,...
I have a xml file like this
<?xml version="1.0" encoding="UTF-8"?>
<gallery >
<gallerydata>
<galleryname>
Home
</galleryname>
<createdat>
14/8/2010 4:53 pm
</createdat>
</gallerydata>
<gallerydata>
<galleryname>
School
</galleryname>
<createdat>
13/8/2010 5:19 pm
</createda...
I always get the undefined index notice, when I run this on wampserver. Tried doing some research before going here, and I integrated the code into this, but still no luck. Please help.
<?php
if(!empty($_GET['lurl']) || ($_GET['lclass']) || ($_GET['lnotes'])) {
$url=$_GET['lurl'];
$clas=$_GET['lclass'];
$notez=$_GET['l...
I'm trying to create a page that tracks some basic user statistics in a database. I'm starting small, by trying to keep track of how many people come using what User Agent, but I've come across a stumbling block. How can I check the User Agent being added to the table to see if it is already there or not?
...
So if I'm on a subcategory page...how can I get the name of the main category?
So let's say I'm on site.com /my-category/my-subcategory/ so how can I get "my-category" ? I don't want to parse the url :) cuz' I think wordpress has a built in function or smth.
Best Regards,
...
I have an eclipse workspace folder. I want to store all the different projects I am working on over here. Now I am working on a PHP project and have WAMP installed. Is there some way to configure eclipse such that it outputs my project files to the server's www folder.
I don't want to create my workspace in the server's www folder, for ...
Hi there, im attempting to make a auto preloader via php an JSON my reason being no other preloaders suit my purposes at this time. Im developing off a WAMP installation with php version 5.3.0 an apache version 2.2.11 an using the following php code:
$rootDir = dirname(__FILE__).'/..';
$imgdir = opendir($rootDir.'/images/');
$i=0;
whi...
I have data in a sql database that'd I'd like to display on a simple website. The data has an initial question ID "IntQID", which is an auto increment field. Every post has an IntQID. There is another field called "ResID", which is the response ID for a post that is responding to a question. The only data that has no ResID is the initial...
Can anyone explain me, why in the session in this case we get the object with 2 properties?
set_error_handler('my_error_handler');
session_start();
$obj = new myclass();
$_SESSION['obj'] = $obj;
$a->b();
class myclass
{
private $a = 1;
private $b = 2;
public function __sleep()
{
return array('a');
}
}
...
How can I benchmark certain peices of code in PHP? I can use timers to calculate the differences, I'm just not sure if it is the best solution out there.
...
Hi,
When I parse an rss file with SimpleXMLElement, I get this object :
object(SimpleXMLElement)#307 (1) {
[0]=>
string(39) "http://workspace/wordpress/hello-world/"
}
$var->0 doesn't works.
I don't know how to do it :(
thanks.
...
Hey friend as you know I am new in iphone I didn't know any think about can anyone help me.
Can I use PHP in iPhone for storing music file And get get this file again when ever I need this any one who can help out this condition or give some hint to solve this
Previously I also put one question about this.But it is with the cloud serve...