Forum Moderators: coopster

Message Too Old, No Replies

Meaning of PHP error message “Notice: Use of undefined constant"

         

alexod

9:14 pm on Aug 28, 2020 (gmt 0)

10+ Year Member Top Contributors Of The Month



I have a an error on my WP website, but can't figure how to fix it. Can you please help me with this.

I have this error in my logs

[28-Aug-2020 20:02:01 UTC] PHP Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /home/***.php on line 21


The code is
<?php/* if($ji == 3){ ?>
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"><?php the_sub_field('block_section__heading');?></button>
<?php } else{*/ ?>
<h3><?php the_sub_field('block_section__heading');?></a></h3>
<?php/* } */?>


I understand that I need to quote array keys here, but don't figure out which one

Any advice will be appreciated.

phranque

10:16 pm on Aug 28, 2020 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you're missing some required whitespace characters. (i.e., after the "<?php")
see the parts i bolded below:
<?php/* if($ji == 3){ ?>
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"><?php the_sub_field('block_section__heading');?></button>
<?php } else{*/ ?>
<h3><?php the_sub_field('block_section__heading');?></a></h3>
<?php/* } */?>

alexod

10:49 pm on Aug 28, 2020 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks Phranque,

I checked my code, looks like I have that required whitespace.

[prnt.sc...]

Try to play, add some spacing - but I'm getting the same error.

phranque

11:54 pm on Aug 28, 2020 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you need this:
<?php /*


not this:
<?php/*

alexod

7:55 pm on Aug 29, 2020 (gmt 0)

10+ Year Member Top Contributors Of The Month



thanks phranque. It works