[RESOLVED] Fatal error: Function name must be a string in C:\wamp\www\test\mylabel.php on line 7
I'm clearly doing something wrong. I ported this piece of code from one I wrote in VBScript (where it works great), but I'm not as familiar with php syntax. Hopefully you can see where I'm going with this. I want to end up with a variable that contains the string of Sh0413C
Code:
$monthCode = array("02", "03", "04", "06", "09", "10", "10", "11", "11", "12", "12", "01");
$monthLetterCode = array("A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M");
$realMonthCode = date("n");
$labelYearCode = date("y");
$arrayMonthCode = $realMonthCode - 1;
$labelMonthCode = $monthCode(arrayMonthCode);
$labelLetterCode = $monthLetterCode(arrayMonthCode);
$myString = "Sh" . $labelMonthCode . $labelYearCode . $labelLetterCode;
This has been resolved. The 2 instances of (arrayMonthCode) needed to be [$arrayMonthCode]
Code:
$monthCode = array("02", "03", "04", "06", "09", "10", "10", "11", "11", "12", "12", "01");
$monthLetterCode = array("A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M");
$realMonthCode = date("n");
$labelYearCode = date("y");
$arrayMonthCode = $realMonthCode - 1;
$labelMonthCode = $monthCode[$arrayMonthCode];
$labelLetterCode = $monthLetterCode[$arrayMonthCode];
$myString = "Sh" . $labelMonthCode . $labelYearCode . $labelLetterCode;
You're trying to use the variable for the monthCode array as a function instead of an array. The following 2 lines need changed:
PHP Code:
$labelMonthCode = $monthCode ( arrayMonthCode );
$labelLetterCode = $monthLetterCode ( arrayMonthCode );
// Change them to:
$labelMonthCode = $monthCode [ $arrayMonthCode ];
$labelLetterCode = $monthLetterCode [ $arrayMonthCode ];
Edit: Looks like you found it already. Sorry I wasn't helpful
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks