Solved

PHP Defined Constants.  Names and Usage Examples

Posted on 2012-04-06
4
433 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 110

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 110

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

738 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