0

Is it possible in NetBeans to tag a line of (e.g. PHP) code and refer to this line number dynamically?, like

echo "check the line number <tagged_line_number> in the script";

Problem is that with code development any line can change a number naturally, so static reference does not make sense.

2 Answers 2

1

If you are seeking the PHP solution, use LINE constant for that.

Sign up to request clarification or add additional context in comments.

1 Comment

It would give me a current line number - not the "tagged" one which I need to refer to. I believe it must be a IDE's (Netbeans in this case) feature that would on code compilation would "magically" convert the tag to number.
0

Actually Vladislav`s answer is the correct one. You definitely could use LINE constant like so:

$line = __LINE__ + 1; // use this right before the line you want to tag
// tagged line goes here
echo "the line number we refer to is $line";

the output will be:

the line number we refer to is 3

Run the example in your browser

But I am afraid the answer to your question

Is it possible in NetBeans to tag a line of code and refer to this line number dynamically?

is "No".

1 Comment

Good advise - thanks. I had not thought about this solution but it practically solves my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.