Go Back   CodingForums.com > Search Forums

Before you post, read our: Rules & Posting Guidelines

Showing results 1 to 25 of 500
Search took 4.86 seconds.
Search: Posts Made By: kbluhm
Forum: PHP 04-30-2013, 08:25 PM
Replies: 1
Views: 116
Posted By kbluhm
http://xdebug.org

http://xdebug.org
Forum: PHP 04-28-2013, 07:05 PM
Replies: 2
Views: 115
Posted By kbluhm
$is_valid = eval( 'return $var >= 5;' ); if...

$is_valid = eval( 'return $var >= 5;' );

if ( $is_valid )
{
// true
}
Forum: Post a PHP snippet 02-20-2013, 04:54 AM
Replies: 4
Views: 951
Posted By kbluhm
And lot of these are a huge overkill. Case in...

And lot of these are a huge overkill. Case in point: array2Text():

function array2Text( $array, $name = 'array' )
{
return '$' . $name . ' = '. var_export( $array, TRUE ) . ';';
}
Forum: PHP 02-01-2013, 07:50 PM
Replies: 2
Views: 260
Posted By kbluhm
You can do that with one query as opposed to a...

You can do that with one query as opposed to a query within the foreach loop:

public function getCarrierByAlphabet()
{

// only run once per request
static $chars;

if ( ! isset(...
Forum: PHP 01-28-2013, 08:40 PM
Replies: 4
Views: 236
Posted By kbluhm
(time()+60*60) == strtotime( '+ 1 hour' ) ...

(time()+60*60) == strtotime( '+ 1 hour' )

$new_time = date( "m/d/y h:i a", strtotime( "+ 1 hour" ) );
Forum: PHP 01-25-2013, 02:40 PM
Replies: 3
Views: 169
Posted By kbluhm
Haha, sorry... I had a simple answer, then got...

Haha, sorry... I had a simple answer, then got curious and did a bit more testing.
Forum: PHP 01-25-2013, 02:28 PM
Replies: 3
Views: 169
Posted By kbluhm
There are special characters at the beginning of...

There are special characters at the beginning of the first EMAIL string. When I copied/pasted the code above, I get 2. When I type everything out manually from scratch, I get 1. If I paste the code...
Forum: PHP 01-23-2013, 04:43 PM
Replies: 3
Views: 236
Posted By kbluhm
$cart_total = 0.0; foreach (...

$cart_total = 0.0;

foreach ( $_SESSION["cart_array"] as $item )
{
$cart_total += ( float ) $item["total_cost"];
}

var_dump( $cart_total ):
Forum: PHP 01-18-2013, 06:33 PM
Replies: 10
Views: 362
Posted By kbluhm
It is a totally separate file that is loaded...

It is a totally separate file that is loaded independently and has no way of grabbing variables that are defined in another file. You'll need to move the variables to a file that is included in both.
Forum: PHP 01-15-2013, 08:46 PM
Replies: 3
Views: 323
Posted By kbluhm
Quick and dirty... this will work, but there...

Quick and dirty... this will work, but there mayyy be a better way:

// highlight ALL instances of `pass`
$dot_afd = preg_replace( '/(pass)/i', '<b><i>$1</i></b>', $dot_afd );

// now remove...
Forum: PHP 01-12-2013, 06:13 PM
Replies: 6
Views: 404
Posted By kbluhm
The OP specifically emphasized wanting a PHP...

The OP specifically emphasized wanting a PHP solution.

This will strip all comments, but exclude thise that begin with <!--[

$html = preg_replace( '/\<\!\-\-[^\[].*\-\-\>/Us', '', $html );
Forum: PHP 01-03-2013, 07:44 PM
Replies: 10
Views: 388
Posted By kbluhm
Ah, well alright then: echo "<a...

Ah, well alright then:

echo "<a href=\"file:///C:/filePath/$file\">$file</a>";

Note the triple slash after file: and single slash after C:
Forum: PHP 01-03-2013, 03:30 PM
Replies: 10
Views: 388
Posted By kbluhm
It's certainly possible, but the only person that...

It's certainly possible, but the only person that will be able to view it is you and anyone else that happens to have a file with that path and name on their local PC... only they'll view their own...
Forum: PHP 12-14-2012, 03:28 PM
Replies: 2
Views: 235
Posted By kbluhm
No need to seed the random number generator since...

No need to seed the random number generator since about 10 years ago ;)

function random_string( $length = 32 )
{

$chars = array_merge( range( 'A', 'Z' ), range( 'a', 'z' ), range( 0, 9 ) );...
Forum: PHP 12-14-2012, 03:12 PM
Replies: 3
Views: 330
Posted By kbluhm
http://www.php.net/date Lowercase m is the...

http://www.php.net/date

Lowercase m is the numeric month with leading zeros (12 == December)

Replace the lowercase m with a lowercase i... which is minutes with leading zeros.

strtotime()...
Forum: PHP 12-13-2012, 09:57 PM
Replies: 1
Views: 254
Posted By kbluhm
What you'll want to do is loop through and use a...

What you'll want to do is loop through and use a key that is a hash of everything except for quantity. You'll use that hash to build a separate array of combined products. If the hash does not yet...
Forum: PHP 12-11-2012, 09:07 PM
Replies: 4
Views: 279
Posted By kbluhm
It's unrelated to the issue at hand, but you're...

It's unrelated to the issue at hand, but you're attempting to utilize parameter sanitizing, which mysql_query does not natively support.

http://www.php.net/mysql_query

Here's a quick and dirty...
Forum: PHP 11-12-2012, 03:45 PM
Replies: 1
Views: 329
Posted By kbluhm
Like this? class general_form { ...

Like this?

class general_form
{

public function call_custom_func( $class, $func )
{
$class = new $class;
return $class->$func();
}
Forum: PHP 11-03-2012, 10:22 PM
Replies: 1
Views: 466
Posted By kbluhm
YouTube has been experiencing some connectivity...

YouTube has been experiencing some connectivity issues. The 503 error text tells you exactly what's going on. Nothing you can do about it.

You could catch the error and on your site say something...
Forum: PHP 10-24-2012, 02:47 PM
Replies: 7
Views: 361
Posted By kbluhm
It appears you're handling it pretty well. Are...

It appears you're handling it pretty well. Are you sure you need a book?
Forum: PHP 10-06-2012, 03:27 PM
Replies: 14
Views: 543
Posted By kbluhm
Yet another alternative for your files vs....

Yet another alternative for your files vs. folders inquiry:

$glob = glob( realpath( $directory ) . '/*' );

// grab all files
$files = array_filter( $glob, 'is_file' );

// grab all folders...
Forum: PHP 10-05-2012, 05:37 PM
Replies: 14
Views: 543
Posted By kbluhm
No, they are excluded. :)

No, they are excluded. :)
Forum: PHP 10-05-2012, 05:15 PM
Replies: 14
Views: 543
Posted By kbluhm
Another solution, once you have a folder path......

Another solution, once you have a folder path... this will count the number of folders immediately within that folder (non-recursive):

$sub_directories = glob( realpath( $directory ) . '/*',...
Forum: PHP 10-05-2012, 07:09 AM
Replies: 7
Views: 611
Posted By kbluhm
Yup, it'd add the current date/time with no...

Yup, it'd add the current date/time with no punctuation, such as print_r.20121005020936.txt, where 20121005020936 is October 5th, 2012, 2:09:36am, and place it in the same folder as the current file....
Forum: PHP 10-05-2012, 06:30 AM
Replies: 7
Views: 611
Posted By kbluhm
Use the second argument to return rather than...

Use the second argument to return rather than print:

file_put_contents(
'./print_r.' . date( 'YmdHis' ) . '.txt',
print_r( $var, TRUE )
);
Showing results 1 to 25 of 500

 
Forum Jump

All times are GMT +1. The time now is 09:52 AM.