Solved

PHP Defined Constants.  Names and Usage Examples

Posted on 2012-04-06
4
429 Views
Last Modified: 2013-11-13
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
Comment
Question by:Ray Paseur
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 37815990
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
 
LVL 108

Author Comment

by:Ray Paseur
ID: 37816214
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
 
LVL 13

Accepted Solution

by:
Hugh McCurdy earned 500 total points
ID: 37817015
Ray,

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

You posed a really good question.  

Hugh
0
 
LVL 108

Author Comment

by:Ray Paseur
ID: 37833990
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This is about my first experience with programming Arduino.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now