vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   if extension exists? (https://vborg.vbsupport.ru/showthread.php?t=78709)

tgillespie 03-24-2005 06:25 PM

if extension exists?
 
Need a little help writing an if statement to check if a certain file with the following extension is present.

PHP Code:

if(file_exists("/" . * . ".jpg")) 

I realize php cannot use *as a wild card character, but was just curious as to how someone woulduse a wildcard file name with a .jpg extension this this statement.

filburt1 03-24-2005 08:30 PM

<a href="http://us4.php.net/manual/en/function.readdir.php" target="_blank">http://us4.php.net/manual/en/function.readdir.php</a> ?

deathemperor 03-24-2005 10:51 PM

what does !== mean ?

Brad 03-25-2005 12:21 AM

Quote:

Originally Posted by deathemperor
what does !== mean ?

Basicly $x !== $y means $x is not equal to $y

noppid 03-25-2005 12:28 AM

It means that if the variables are not cast as the same type they will eval as not equal.

filburt1 03-25-2005 01:10 AM

Quote:

Originally Posted by deathemperor
what does !== mean ?

If they are not the same exact value.

== compares string representations; != is the inverse
=== compares the exact values depending on the type; !== is the inverse

For example:
PHP Code:

123 == "123" // is true
123 === "123" // is false; the first is numeric, the second is a string 


tgillespie 03-25-2005 03:40 AM

Thanks filburt. Readdir was exactly what I was looking for.

sabret00the 03-25-2005 03:50 PM

can i just ask what's the difference between != and !==?

nevermind it appears to be the same as == and === :-S

AN-net 03-25-2005 04:28 PM

so wait...
== is used for numerics and === is used for strings. woops^.^

Guest190829 03-25-2005 06:13 PM

Quote:

Originally Posted by an-NET
so wait...
== is used for numerics and === is used for strings. woops^.^

No, I think == means equal, while === means identical. It's not based on whether it's a string or numerical value.

In filburt's example

PHP Code:

123 == "123" // is true
123 === "123" // is false; the first is numeric, the second is a string 

123 is equal to "123" // is true
123 is identical to "123" // is false, the quotations indicate the 123 as a string.

I could be wrong though. I'm still learning.

filburt1 03-25-2005 06:16 PM

Manual == good.

http://us3.php.net/manual/en/languag...comparison.php

Marco van Herwaarden 03-25-2005 07:45 PM

Simple put == means it holds the same value, === is also checking on the type.

deathemperor 03-28-2005 03:13 PM

nice points, thanks guys


All times are GMT. The time now is 07:03 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01401 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (13)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete