Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:

PHP Defined Constants. Names and Usage Examples

Is there any online reference that tells us the meaning and usage of the PHP defined constants?  For example among many hundreds) what is the expected usage of CURLE_FTP_WEIRD_SERVER_REPLY?  Or CAL_JEWISH_ADD_ALAFIM_GERESH? Or INF or TYPEOTHER?  I can find mention of some of these things in various places in www.php.net but no consolidated descriptions.  So far the best I can come up with is this, which is OK for a search, but not very convenient for a study tool.
Please see: http://laprbass.com/RAY_get_defined_constants.php
<?php // RAY_get_defined_constants.php
error_reporting(E_ALL);

// SHOW ALL THE CONSTANTS -- EXPECT A LOT OF OUTPUT
// SEE: http://php.net/manual/en/function.get-defined-constants.php

// DEFINE ONE OF OUR OWN
define('ZZZZ_FOO', 'bar');

$c = get_defined_constants();
$n = number_format(count($c));
ksort($c);

// MAKE CLICKABLE LINKS
foreach ($c as $k => $v)
{
    $a
    = '<a'
    . ' target="_blank"'
    . ' href="http://php.net/results.php?l=en&p=wholesite&q='
    . urlencode($k)
    . '">'
    . $k
    . '</a>'
    ;
    $c[$a] = $v;
    unset($c[$k]);
}

// SHOW THE WORK PRODUCT
echo "<pre>";
echo "THERE ARE $n PREDEFINED PHP CONSTANTS";
echo PHP_EOL;
print_r($c);

Open in new window

Thanks, ~Ray
0
Ray Paseur
Asked:
Ray Paseur
  • 2
  • 2
1 Solution
 
Hugh McCurdyCommented:
Ray, I don't know but I have a suggestion.  I was curious so I did some searches, starting with the Jewish constant.  I suspect you already know it has to do with Jewish dates and that their calendar starts before Jesus.  All I figured out that Geresh seems to be an apostrophe and Gershayim appears to be a quotation mark.  http://en.wikipedia.org/wiki/Gershayim

My suggestion for the Jewish constants is to ask a new question with the constants in the header.  Hopefully, someone with a Hebrew education will be able to shed some light on the standards for the Jewish calendar.  BTW, Jews are starting Passover at sunset tonight.  (So, in some parts of the world, it's started.  Might be some time before you get a reply if you wait.)

My thought is the usage is obvious to someone with a (good) Hebrew education and thus the explanation in the manual is lacking.  (I could be wrong, however.)  In any event, interesting question.
0
 
Ray PaseurAuthor Commented:
Thanks, Hugh.  The Jewish date constant is just one example (there are a lot of Israeli guys who have contributed to PHP).  To clarify, my question is a little more broad.  I found 1,612 defined constants in my PHP installation.  I am kind of thinking that since there is a function reference in the php.net site, would there be a constant reference?  I can't find one.  It may not exist, but if it does I would sure like to see it!  Cheers, ~Ray
0
 
Hugh McCurdyCommented:
Ray,

I agree.  I'd like to see a constant reference too.

You posed a really good question.  

Hugh
0
 
Ray PaseurAuthor Commented:
Hugh:  Don't spend all your points in one place!  I'm closing this out - looks like it doesn't exist.  All the best, ~Ray
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now